# 2048

Slide and merge numbered tiles to reach 2048, with undo, best score and keyboard or swipe controls.

## URL

https://ilham.dev/tools/game-2048/

## What It Does

The classic 2048 puzzle, rebuilt as a single page. Slide the board with the arrow keys, WASD or a swipe; equal tiles merge into one and a fresh tile appears after every move. The current score, the best score on this device and a one-step undo sit above the board. The game is won when a 2048 tile appears, but play continues for a higher score. Everything runs locally and nothing is uploaded.

## Features

- Runs in the browser
- No login required

## Input

text input.

## Output

text output.

## Privacy

Processing happens locally in the browser.

No input data is uploaded to ilham.dev.

- Requires login: false
- Requires API key: false
- Stores user data: false


## Examples

- How does merging work?
- Where is my best score kept?
- What does undo do?
- Why did the game end when I still had empty squares?
- Is there a strategy?




## Questions

### How does merging work?

A move slides every tile as far as it will go in that direction. Two tiles of the same value that meet merge into one tile of double the value, and a tile that has already merged once in a move cannot merge again. That single-merge rule is why sliding left can pair the first two tiles but leave the third of a triple alone.

### Where is my best score kept?

In this browser's local storage, under a key that belongs to this page. It survives reloads and never leaves your device. Clearing site data resets it.

### What does undo do?

It steps back exactly one move, including the score you gained and the random tile that appeared. There is only one level of undo, so use it to recover from a mis-swipe rather than to rewind a whole game.

### Why did the game end when I still had empty squares?

This implementation ends the round only when **no empty cell remains and no adjacent pair can merge**. If there is an empty cell, another move is still possible somewhere—even if the direction you just pressed did nothing.

### Is there a strategy?

Most strong players keep their largest tile in one corner and build a descending chain along two edges, never moving the corner tile away. Deciding early which corner that is matters more than any single merge.

