explaingit

gabrielecirulli/2048

13,249JavaScriptAudience · generalComplexity · 1/5LicenseSetup · easy

TLDR

The original open-source browser game 2048, a sliding-tile puzzle where you combine numbered tiles to reach 2048. Runs in any web browser with no install needed.

Mindmap

mindmap
  root((repo))
    What It Does
      Sliding tile puzzle
      Combine tiles to 2048
      Score tracking
    Tech Stack
      JavaScript
      HTML and CSS
      No framework
    Use Cases
      Play in browser
      Fork and customize
      Study game code
    Audience
      Casual players
      JS beginners
      Web learners
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Fork the repo and add a new game mode, board size, or custom tile theme.

USE CASE 2

Study how a viral browser game is built using plain JavaScript with no framework.

USE CASE 3

Embed the game on a personal or educational website as an interactive example.

Tech stack

JavaScriptHTMLCSS

Getting it running

Difficulty · easy Time to first run · 5min
MIT, use for any purpose including commercial, as long as you keep the copyright notice.

In plain English

This repository holds the source code for 2048, the well-known sliding-tile puzzle game that runs in a web browser. The author, Gabriele Cirulli, describes it plainly as a small project made just for fun, and the README links to a page where you can play it directly. The README is upfront about the game's origins. It calls 2048 a clone of an earlier game called 1024, which was itself based on another version, and it credits the game Threes as an indirect inspiration. In other words, the author is open about building on ideas that already existed rather than claiming the concept as original. Most of the README is given over to thanking people. It names two maintainers and lists several contributors along with what each of them added: storage for your best score, swipe handling on mobile devices, swipe support on Windows Phone, and support for an older version of Android. There is also a note thanking many others for smaller contributions. A screenshot is included, and the author jokes that the image is fake because he never actually reached the 2048 tile himself. For people who want to get involved, the README invites changes through forking and pull requests, asks that work be done in a dedicated branch, and points to a separate contributing guide for the same instructions. The code is released under the MIT license, a permissive open-source license. The README closes with a short note that the project was made in spare time and hosted on GitHub at no cost, along with a Bitcoin address for anyone who wants to leave a small donation. Overall this is a simple, personal project page rather than a formal product README.

Copy-paste prompts

Prompt 1
I cloned gabrielecirulli/2048. Show me how to change the board size from 4x4 to 6x6.
Prompt 2
Using the 2048 source code, add a dark mode toggle that switches tile and background colors.
Prompt 3
Help me add a high-score leaderboard to the 2048 game that saves scores in localStorage.
Prompt 4
Explain how the sliding and merging logic works in the 2048 JavaScript source so I can add an undo button.
Open on GitHub → Explain another repo

← gabrielecirulli on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.