A 2048 game api for training supervised learning (imitation learning) agents
- code only tested on linux system (ubuntu 16.04)
- Python 3 (Anaconda 3.6.3 specifically) with numpy and flask
#代码结构:
game2048/
: the main package.game.py
: the core 2048Game
class.agents.py
: theAgent
class with instances.I added TrainAgent and TestAgent classes.displays.py
: theDisplay
class with instances, to show theGame
state.expectimax/
: a powerful ExpectiMax agent by here.CNN.py
: a convolution nueral network for trainning.one_hotboard.py
: transfer board to onehot board.calculatedata.py
: use some properties of the board let train faster.
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.- 'train.py': used to train CNN
#代码运行:将git网址下的代码clone到本地后在pycharm中新建project并打开,直接运行evaluate,等到控制台输出结束命令时在my2048-api文件夹下的EE369.log文件中可以得到将结果。或者在my2048-api中打开终端,输入chmod a+x evaluate.py,回车后再输入python evaluate.py即可。权重文件是model2048.pkl。