Skip to content

NTgGamer1/2048_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2048 Clone (Vanilla JS)

A portfolio-ready clone of the classic 2048 game built with plain HTML, CSS, and JavaScript.

This project includes:

  • 4x4 board rendering and tile updates
  • Arrow-key and swipe controls
  • Tile merge rules and score tracking
  • Random tile spawning (2/4)
  • Best score persistence with localStorage
  • Game-over detection and restart flow

Project Structure

.
├── index.html
├── css/
│   └── style.css
├── js/
│   └── script.js
└── README.md

Installation

  1. Clone the repository:
git clone https://github.com/ntggamer1/2048_Game.git
cd 2048_Game
  1. Run locally (any one option):
# Option A: open directly
open index.html

# Option B: serve with a local static server
python3 -m http.server 5500
# then visit http://localhost:5500

Usage

  • Use Arrow Up, Arrow Down, Arrow Left, Arrow Right to move tiles.
  • On mobile, swipe in any direction.
  • Merge matching values to increase your score.
  • Click New Game or Play Again to restart.

Screenshots / Demo

Add your own captures before publishing:

Gameplay Screenshot

Tech Stack / Why I Built This

Tech Stack

  • HTML5 (semantic structure)
  • CSS3 (responsive layout, modern styling, tile animations)
  • Vanilla JavaScript (game logic + DOM rendering)

Why I Built This

I built this project to demonstrate strong fundamentals in front-end development without frameworks:

  • translating product behavior into data structures and algorithms
  • writing maintainable, testable JavaScript logic
  • designing clean UI and interaction states for desktop and mobile

Testing Notes

Phase-wise checks performed:

  • file structure and resource link validation
  • JavaScript syntax validation (node --check js/script.js)
  • core logic assertions for merging, spawning, movement, and game-over detection

License

This project is available under the MIT License.

About

A responsive 2048 puzzle game built from scratch using vanilla HTML, CSS, and JavaScript, featuring custom grid logic and dynamic tile rendering.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors