Skip to content
AI player and opponent for 2048
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
js
meta
src
style
.gitignore
.jshintrc
LICENSE.txt
README.md
Rakefile
favicon.ico
index.html

README.md

AI-2048

Modification of Gariele Cirulli's 2048 to include player and system AI. View it on Github Pages.

Modifying the AI file

In order to speed up execution time, ai.js contains code compiled using Emscripten compiler. Follow the below steps to modify ai.js:

  1. Make sure you have Emscripten installed.
  2. Get TommyDS and place its C files in the src folder. The hashtable provided by TommyDS is used to cache parts of the expectimax search.
  3. Make the desired changes in src/ai.c.
  4. Compile to js/ai.js by running the following in the root folder: emcc src/tommy.c src/ai.c -o js/ai.js -O3 --post-js "src/ai.post.js" -s EXPORTED_FUNCTIONS="['_main', '_next_player_move', '_next_system_tile']" --memory-init-file 0

License

2048 is licensed under the MIT license.

You can’t perform that action at this time.