Key Features
- • Full implementation of 2048 gameplay mechanics.
- • Keyboard controls (arrow keys) for intuitive play.
- • Real-time score tracking and win/lose state detection.
- • Spawning of random tiles (2 or 4, with 10% chance for 4).
- • Main game methods:
- ◦ start() / restart()
- ◦ moveLeft() / moveRight() / moveUp() / moveDown()
- ◦ getState() / getScore() / getStatus()
- • Win condition: tile with value 2048 appears.
- • Lose condition: no valid moves available.
- • UI updates dynamically:
- ◦ Start message is hidden on first move.
- ◦ Button changes from Start to Restart.
- ◦ Win and Game Over messages displayed appropriately.
Tools Used
HTML
CSS
JavaScript
Modular JS