ovolve/2048-AI

A simple AI for 2048

JavaScript

1,509

119 commits

updated Nov 7, 2023

See the code

README

2048 AI

AI for the game 2048.

See it in action here. (Hit the auto-run button to let the AI attempt to solve it by itself)

The algorithm is iterative deepening depth first alpha-beta search. The evaluation function tries to keep the rows and columns monotonic (either all decreasing or increasing) while aligning same-valued tiles and minimizing the number of tiles on the grid. For more detail on how it works, check out my answer on stackoverflow.

You can tweak the thinking time via global var animationDelay. Higher = more time/deeper search.

It achieves success rate of about 90% in my testing.

ovolve/2048-AI

A simple AI for 2048

JavaScript

1,509

119 commits

updated Nov 7, 2023

See the code

README

2048 AI

AI for the game 2048.

See it in action here. (Hit the auto-run button to let the AI attempt to solve it by itself)

The algorithm is iterative deepening depth first alpha-beta search. The evaluation function tries to keep the rows and columns monotonic (either all decreasing or increasing) while aligning same-valued tiles and minimizing the number of tiles on the grid. For more detail on how it works, check out my answer on stackoverflow.

You can tweak the thinking time via global var animationDelay. Higher = more time/deeper search.

It achieves success rate of about 90% in my testing.

Significant stargazers

Filip W

905 followers · starred Apr 2014

Jacob Bandes-Storch

241 followers · starred Mar 2014

Aaron Powell

1,484 followers · starred Mar 2014

Jakub Zarybnicky

14 followers · starred Mar 2014