Back to Projects
Oct 2025

2048 n-tuple AI

Gets 2048 70% of the time

Interactive Demo

Score
0
Moves
0
Max Tile
0
Best: 0
Games: 0

This project implements an n-tuple network that learns optimal move sequences to beat 2048. (I also set up an API for the demo). n-tuple networks use a lookup table to store position weights, but in 2048 to store every position (assuming a max tile of 32768) would create a lookup table of size (15 + 1)^16. This is because there are 16 possible positions, and 16 values possible in those positions. Instead of storing the entire board in one lookup table, the board is broken up into many lookup tables or tuples. In this case there are 17 tuples of length 4. Each tuple then 'votes' on the next best action, based off reinforcement learning. Each lookup table is of size (15+1)^4. 17 tuples of size 4 is 1114112, while one tuple of size 16 is 1.8446744e+19.