User Rating 0.0
Total Usage 0 times
Category Logic Games
PLAYER 1 (WASD)
SCORE 0

Game Over!

PLAYER 2 (Arrows)
SCORE 0

Game Over!

Is this tool helpful?

Your feedback helps us improve.

About

This tool is a dual-instance implementation of the sliding tile puzzle, designed for local competitive play. Unlike the standard single-player variant, this application runs two independent game logic threads simultaneously within the browser DOM, allowing two users to compete side-by-side on a single device.

The core mechanic relies on a deterministic sliding algorithm. When a directional input is triggered (Vector v), all tiles shift maximally in that direction. If two tiles of value x collide, they merge into a single tile of value 2x. The game ends when the grid is full and no adjacent tiles satisfy the condition tilei,j = tileneighbor.

Pro Tip: Use the "Tabletop Mode" toggle on tablets to invert Player 1's screen, enabling a face-to-face seating arrangement.

2048 puzzle multiplayer split-screen local-coop

Formulas

The scoring algorithm for a single merge event is defined as:

Scorenew = Scoreold + {

vA + vB if vA = vB0 otherwise

Where v represents the numerical value of a tile. The maximum theoretical score depends on the spawn probability of 4s versus 2s.

Reference Data

Tile Value (2n)Probability (P)Color HexPoints per Merge
20.9 (Spawn)#eee4da4
40.1 (Spawn)#ede0c88
8Merge Only#f2b17916
16Merge Only#f5956332
32Merge Only#f67c5f64
64Merge Only#f65e3b128
128Merge Only#edcf72256
2048Target#edc22e4096

Frequently Asked Questions

The game maps input events to two separate instances. Player 1 controls the left board using WASD keys, while Player 2 controls the right board using the Arrow keys. The input handler listens to the global window object and routes the keycode to the respective game engine.
Yes. The application uses the browser's LocalStorage API to serialize the state (grid configuration and score) of both players after every move. Reloading the page deserializes this data to restore the exact board state.
A deadlock occurs when the 4x4 grid is completely filled and no legal moves exist (no empty cells and no adjacent tiles of the same value). The system detects this state by running a simulation of all 4 directional moves; if all result in a Grid Change = FALSE, the Game Over flag is triggered for that player.
Yes. On touch devices, the screen is split into two touch zones. Swiping inside the Player 1 zone controls Board 1, and swiping in the Player 2 zone controls Board 2. A "Tabletop Mode" is available to rotate the top board for face-to-face play.