Recreation of the famous sliding block puzzle game originally coded by Gabriele Cirulli.
The aim was to challenge myself to make it implementing testing first, and to keep to good coding conventions.
Use the up, down, left and right arrow keys to play.
Live version working here
git clone git@github.com:puyanwei/2048.git
cd 2048
open index.html
For testing
open specRunner.html
- HTML
- Javascript
- Jasmine
- Slide blocks by using the up, down, right and left arrow keys.
- Keeps a tally of your score.
- Keeps a count of the number of moves you make.
- Restart button resets a game.
- Good testing coverage.
- Good naming conventions, functions are short as possible using the Single Responsibility Principle, refactor repetition code.
- Code is readable for humans! Descriptive function names over writing comments.
- Small commits and good descriptions.
Unable to test jQuery in the same way as game.js using Jasmine, there are a few options the main one being that we test it using a front end user interface tester such as nightwatch.js.
Code still needs a lot of improvement, there is a lot of repetition espcially in the interface.js that can be refactored. Game.js is too long and should be refactored into smaller files to spread out the dependencies.
