Skip to content

charlotte12l/2048-api

 
 

Repository files navigation

2048-api

A 2048 game api for training supervised learning (imitation learning) or reinforcement learning agents

Statement

It is a course project and TA provides us with an expectimax agent which can get scores above 2048. Therefore, we can collect board and the agent’s corresponding solution (direction: up, down, left, right). It’s just like an image classification task where boards are parallel to images, solutions are parallel to labels. Our aim is to make our own agent's score reach 900+.

Deep learning part. My net: game2048/Model.py, training: game2048/train_CNN.py.

Code structure

Requirements

  • code only tested on linux system (ubuntu 16.04)
  • Python 3 (Anaconda 3.6.3 specifically) with numpy and flask
  • Pytorch

To train the net

Before train the net, you should create the dir ./game2048/saved
then:
python3 train_CNN.py

To evaluate LXYAgent

python3 evaluate.py >>evaluation.log

To generate fingerprint

python3 generate_fingerprint.py

To compile the pre-defined ExpectiMax agent

cd game2048/expectimax
bash configure
make

To run the web app

python webapp.py

demo

LICENSE

The code is under Apache-2.0 License.

About

A 2048 api for training supervised learning (imitation learning) or reinforcement learning agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 88.4%
  • JavaScript 8.3%
  • Shell 1.3%
  • Python 1.0%
  • C++ 0.5%
  • C 0.3%
  • Other 0.2%