Zhiyang He, Charles Lu, Stephen Ou
CS 221 at Stanford University with Percy Liang, Autumn 2015
We explore various techniques to play 2048:
- Randomized and pure strategies
- Search strategies, i.e. expectimax and minimax
- Reflex strategies, i.e. regression and neural networks
- Reinforcement strategies, i.e. Q-learning
To run the front end:
- Install Flask using
pip install Flask
- In the main directory, run
python app.py
, then navigate tolocalhost:5000
gameState.py
: provides an abstraction for the 2048 gameagents.py
: contains logic behind each of our AI agentsplay.py
: backend only simulation entry pointeval.py
: implements various evaluation functions to score game boarddata.py
: methods to read and write raw board and move label data for reflex model trainingtests.py
: unit tests for the 2048 game state and evaluation functionsutil.py
: miscellanous utility functionsreflex.py
: Theano script to train various reflex modelsappQ.py
: Flask server used to connect Q-learning agentsgameStateQ.lua
: the Lua training script thatappQ.py
connectsgameStateQ.py
: backend-only Q-learning, does the same thing as appQ.py without frontendgameStateQInit.lua
: Lua script used to reset local data filesdeepqlearn.{lua,moon}
: DeepQLearning framework by blakeMilnerapp.py
: the main entry point for Flask (a Python framework), used to connect search agentstemplates/index.html
: homepage for the 2048 game frontendstatics/*.js
: logic for the 2048 game (forked from the original 2048 game by Gabriele Cirulli)