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.
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
Navigate to project directory and run
./gradlew run -Dexec.args="firefox"
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"