A 2048 game api for training supervised learning (imitation learning) follow ExpectiMax agent and create your own CNN model
game2048/
: the main package.game.py
: the core 2048Game
class.agents.py
: theAgent
class with instances.displays.py
: theDisplay
class with instances, to show theGame
state.expectimax/
: a powerful ExpectiMax agent by here.
explore.ipynb
: introduce how to use theAgent
,Display
andGame
.static/
: frontend assets (based on Vue.js) for web app.webapp.py
: run the web app (backend) demo.evaluate.py
: evaluate your self-defined agent. test time = 50online_train.py
: get your own agent's weight.The structure of the model can be foundCNN_new_141.zip
: best model weight file trained by me
- code only tested on linux system (ubuntu 16.04)
- Python 3 (Anaconda 3.6.3 specifically) with numpy and flask
- Tensorflow,keras,numpy
python online_train.py
- you will get your own model taught by ExpectiMax agent
In file ./game2048/agent.py
class MyAgent(Agent):
def __init__(self, game,display=None):
super().__init__(game, display)
self.model1= model_my
# self.model2= model2
# self.model3= model3
# print("load_model",modelpath1)
def step(self):
...
return direction
cd game2048/expectimax
bash configure
make
python evaluate.py
you will get the average score of your agent (original test time is 50)
python webapp.py
The code is under Apache-2.0 License.
Please read here.