Skip to content

TheoKanning/2048-Python-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

2048-Python-Bot

A Python bot that plays 2048. Uses screen grabbing to determine the game state and a basic tree search to calculate moves.

https://gabrielecirulli.github.io/2048/

Currently reaches 2048 a little under 50% of the time.

Screen grabbing code is taken from this excellent example, and you'll have to calculate the game coordinates to match your screen size!

http://code.tutsplus.com/tutorials/how-to-build-a-python-bot-that-can-play-web-games--active-11117

Search

During tree search, the computer is simulated as an opponent that aims to create tiles in the worst possible location, and the bot picks the move that minimizes the risk of bad random placements.

Simple heuristics are used to reward good behaviors, such as keeping the top row full and keeping numbers in order so they can be combined easily.

About

A 2048 Bot written in Python using an adversarial search algorithm. Uses screen grabbing to determine the game state and a basic tree search to calculate moves.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages