Skip to content

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

License

Notifications You must be signed in to change notification settings

mingsjtu/2048-api

 
 

Repository files navigation

2048-api

A 2048 game api for training supervised learning (imitation learning) follow ExpectiMax agent and create your own CNN model

Code structure

Requirements

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

model structure

model

for train

python online_train.py
  • you will get your own model taught by ExpectiMax agent

My own agents

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

To compile the pre-defined ExpectiMax agent

cd game2048/expectimax
bash configure
make

For test your model value

python evaluate.py

you will get the average score of your agent (original test time is 50)

To run the web app

python webapp.py

demo

LICENSE

The code is under Apache-2.0 License.

For EE369 students from SJTU only

Please read here.

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 89.6%
  • JavaScript 8.4%
  • Python 0.6%
  • C++ 0.5%
  • Shell 0.5%
  • C 0.2%
  • Other 0.2%