2048
Saved games stay in this browser only.
About the game
This is 2048, the sliding number puzzle, on a fantasy console. The board is a four by four grid that starts with two tiles marked 2. Every press of an arrow key slides every tile on the board as far as it will go in that direction, and when two tiles with the same number run into each other they merge into one tile with their sum: two 2s make a 4, two 4s make an 8, and so on. After every move a new tile, usually a 2 and sometimes a 4, appears in a random empty square.
The aim is to keep merging until a tile reaches 2048, and then to keep going for as long as the board has room. The counter at the top, Total, adds up the values of all the tiles on the board.
This version has a few quirks of its own. Merges can chain within a single move: a row of 2, 2 and 4 collapses straight into an 8. A new tile appears after every key press, even when nothing on the board could move. And the game never announces the end: when the grid is full and no move is left, press Z to start over.
Playing it here
2048 was made for WASM-4, a fantasy console: an imaginary handheld with a 160 by 160 screen, four colours, a D-pad and two buttons, for which independent developers write new games. Peter Hellberg wrote it in Go in 2021, compiled with TinyGo, and it runs here in the official WASM-4 runtime. Click Play and the first board is ready after a short "LETS GO!" banner. A ticking rhythm plays in the background, and every slide makes a short sound.
Nothing is saved between visits, but Enter opens the WASM-4 menu, where you can save and load the state while the page is open (2 and 4 do the same directly). A gamepad works too, and on touch screens an on-screen D-pad and buttons appear.
Controls
| Key | WASM-4 button | Action |
|---|---|---|
| Arrow keys | D-pad | slide the tiles |
| Z | button 2 | new game |
| X | button 1 | pick a colour palette at random |
| Enter | — | WASM-4 menu |
C or the comma key also work as Z, and Space, V or the period key as X.
A few things worth knowing
Keep the big tile in a corner. The classic strategy works here too: pick a corner, keep the largest tile there and build a chain of decreasing numbers along one edge, using mostly two or three directions.
Every key press counts. Since a tile arrives even when nothing moves, pressing towards a wall that is already packed only fills the board faster.
Chains can surprise you. Because merges continue down the row, one move can turn several small tiles into a much bigger one, which helps, but it can also pull apart a row you were building.
Pick a palette you like. X picks one of ten four-colour palettes at random, from warm pinks and oranges to greys, blues and greens; press it again until you find one you like. It does not affect the game.
Credits and licence
This version of 2048 was created by Peter Hellberg, who wrote it in Go for the WASM-4. Its game logic was first based on a command-line 2048 in Go by Amit Chhabra (MIT licence), and its colour palettes come from the Lospec palette list, as credited in the code. The sliding-tile game itself was created by Gabriele Cirulli in 2014. This version is released under the MIT licence, published with the source code in Peter Hellberg's repository on GitHub. The compiled game also contains the WASM-4 bindings (ISC licence), parts of the TinyGo runtime and the Go standard library (BSD licences) and a few routines from wasi-libc (MIT licence). It runs here in the WASM-4 runtime (ISC licence). The licence texts are linked from this page.