A JavaScript implementation of the 2048 game, where players combine tiles to reach the number 2048.
Okay, okay. Also, we have some rules:
- The game field is 4 x 4
- Each cell can be empty or contain one of the numbers: 2, 4, 8 ... 2^n
- The player can move cells with keyboard arrows
- All the numbers should be moved in the selected direction until all empty cells are filled in - 2 equal cells should be merged into a doubled number - The merged cell can’t be merged twice during one move
- The move is possible if at least one cell is changed after the move
- After move 2 or 4 appears in a random empty cell. 4 probability is 10%
- When 2048 value is displayed in any cell, win message should be shown.
- HTML
- CSS (SCSS)
- JavaScript
- Preview: DEMO LINK
- Mockup: Original 2048
- Fork the repo.
- Clone the forked repo.
- Run
npm install
(ornpm i
). - Run
npm start
.