Adversarial 2048

2048, but the RNG is always against you

New Game

How to play: Use your arrow keys to move the tiles. When two tiles with the same number touch, they merge into one!

What's going on?

Normally, 2048 is a 1-player game - you slide tiles around while new tiles are randomly generated. But in Adversarial 2048 you have an opponent: a computer program running in the background which tries to minimize your score, by placing new tiles in the worst possible location.

How does it work?

By turning 2048 into a 2-player zero-sum game, the program can use the minimax algorithm to figure out its best move (or worst move, from your perspective). It searches 11 moves ahead, calculating millions of future game states and evaluating them with a heuristic function, much like a chess engine. Since the number of possible states grows exponentially, it uses optimizations like alpha-beta pruning to avoid checking the entire search tree.

Adversarial 2048 was created by Howard Halim, inspired by Hatetris and Absurdle by qntm, and based on the original 2048 by Gabriele Cirulli. The code is open source on Github.