The sliding-tile puzzle, written from scratch in plain JavaScript.
I wrote this version of the 2048 puzzle game without a framework or game library. Instead of writing separate logic for all four directions, the board is rotated so that every move becomes a slide to the left, compressed and merged, then rotated back.
You play with the arrow keys or WASD. A new tile only spawns when a move actually changes the board, and there’s a one-step undo I added for debugging.
Click the board, then play with the arrow keys. On a phone, swipe.
Open full screen ↗