Skip to content

An AI player for the game "2048" using Minimax, Alpha-Beta pruning and heuristics.

License

Notifications You must be signed in to change notification settings

spirosbax/2048-ai

Repository files navigation

Overview

This is an artificial intelligence bot for the 2048 puzzle game. The file PlayerAI_3.py file contains the code for the bot.
I used the minimax algorithm combined with alpha-beta pruning to pick the best move in a 200 milisecond time limit.

The algorithm achieves:
256: 100%
512: 100%
1024: 85%
2048: 20%

Dependencies

  • python 3.5 or later
  • git

The following lines should install python3.5 on your computer,

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.5

Next we need to install git

sudo apt-get install git

Usage

git clone https://github.com/spirosbax/2048-ai.git

This will create a directory called "2048-ai" containing the repository files, then do

cd 2048-ai

Then run the file with

python3 GameManager_3.py

Development

I am open to suggestions for improving the heuristics, feel free to contribute.
Want to contribute? Great!
Fork the repository and start coding!

Credits

I used distribution code provided by: https://www.edx.org/course/artificial-intelligence-ai-columbiax-csmm-101x-1

Releases

No releases published

Packages

No packages published