A simple AI for 2048
CSS JavaScript HTML
Switch branches/tags
Nothing to show
Pull request Compare This branch is 15 commits ahead, 9 commits behind ovolve:master.
Latest commit 1e1e88e Sep 25, 2017 @ronzil ronzil ...
Permalink
Failed to load latest commit information.
img AI. Mar 11, 2014
js optimized grid.js to run faster May 25, 2014
meta custom bitcoin icon Mar 11, 2014
style added text field for run count. May 21, 2014
.gitignore basic styling Mar 5, 2014
.jshintrc basic grid implementation with initial setup Mar 8, 2014
CONTRIBUTING.md add contributing guide Mar 10, 2014
LICENSE.txt add license Mar 10, 2014
README.md added SO link May 25, 2014
favicon.ico add favicon Mar 11, 2014
index.html ... Sep 25, 2017

README.md

2048 AI - Using no hard-coded knowledge about the game.

AI for the game 2048.

See it in action here.

After seeing several AI projects for the game, I was interested in creating an AI that does not contain any hard-coded knowledge about the game (like scoring functions, heuristics etc). Instead the AI should "find out for itself" without me, the programmer having to know anything about game strategy.

The implemented algorithm chooses which move to play like this: For each possible move, play it and then continue to play random moves until the game is finished. This is done many times and the move that returns the highest average score is chosen.

The success of the AI is surprising as a random-walk game finishes quite quickly, yet choosing the highest yielding move among the random-walk games, results in very good game play. Using only 100 runs per move the AI reaches the desired 2048 tile 80% of the runs and the 4096 tile 50%!

I've also created a version in C++ using the very clever and highly optimized version by nneonneo. You can find it here

For a detailed discussion, check out my answer on stackoverflow.