Skip to content

MathiasStokholm/Kt2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kt2048

AI for the 2048 game, implemented in Kotlin!

This AI uses a Expectimax search routine, coupled with a heuristic scoring function courtesy of @nneonneo. The entire board (4x4 tiles) is encoded as two 64-bit integers. Moves are pre-calculated and stored in a lookup table for fast access. The search is parallelized by running subsearches from each top-level move on different threads, and ultimately combining the results. A transposition table is shared across threads and used to save and lookup previously scored grids.

Running the AI

To run the game, the program utilizes Selenium to interface with a browser of your choice.

To execute Gradle tasks (such as running the program), navigate to the project directory and invoke either "gradlew.bat" for Windows or "./gradlew" for Linux/Mac

Firefox (Requires working Firefox installation)

Navigate to project directory and run

  ./gradlew run -Dexec.args="firefox"

Chrome (Requires working Chrome installation and ChromeDriver executable)

Download the ChromeDriver executable from https://sites.google.com/a/chromium.org/chromedriver/downloads Navigate to project directory and run

  ./gradlew run -Dexec.args="chrome [path-to-chromedriver]"
  e.g. ./gradlew run -Dexec.args="chrome C:/chromedriver.exe"

Enjoy!

highscore 2

About

AI for the 2048 game, implemented in Kotlin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages