Welcome to my implementation of the classic 2048 game — built from scratch using JavaScript, HTML5, and CSS3 with a fully responsive and polished UI.
This is a web-based version of the iconic puzzle game 2048, where your goal is to merge tiles with the same numbers to reach 2048. The game combines creative UI handling with custom-built game logic and state management.
- Smart tile merging and movement (no double merges in one move)
- Dynamic random tile generation (with 10% chance of 4)
- Score tracking based on merged tile values
- Win and Game Over detection
- Keyboard arrow support (
↑,↓,←,→) - Responsive UI for desktop and mobile
- Separated game logic and UI for clean structure
Gameclass with methods:moveLeft(),moveRight(),moveUp(),moveDown(),start(),restart()etc.
- Polished design with visual feedback for tiles
- Start/Restart button with dynamic behavior
- Mobile-friendly layout
- JavaScript (ES6+)
- HTML5
- CSS3 / SCSS
- Responsive Design
- Vanilla DOM Manipulation
- git clone https://github.com/Dominik-Dudek-code/2048_game.git
- cd js_2048_game
- npm install
- npm start
Or simply open index.html directly in your browser (no build process required).
Run available tests with:
- npm run test
Optional:
- npm run test:only -- -n # Fast test without linter
- npm run test:only -- -l # Fast test with logs
This project was created as part of a learning challenge and is open for improvement, refactoring, and experimentation. Feel free to fork and build on it!
👨💻 Dominik Dudek 🔗 GitHub 📫 dominik.dudek.praca@gmail.com