Skip to content

ovolve/2048-AI

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 66 commits ahead, 123 commits behind gabrielecirulli:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
img
 
 
js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

A simple AI for 2048

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 47.0%
  • CSS 27.2%
  • SCSS 18.3%
  • HTML 7.5%