Skip to content

Educational API for developing ML (imitation learning or reinforcement learning) agents to play game 2048

License

Notifications You must be signed in to change notification settings

Aoimoonyhq/2048-api

 
 

Repository files navigation

2048-api

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

Code structure

Requirements

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

To define your own agents

from game2048.agents import Agent

class YourOwnAgent(Agent):

    def step(self):
        '''To define the agent's 1-step behavior given the `game`.
        You can find more instance in [`agents.py`](game2048/agents.py).
        
        :return direction: 0: left, 1: down, 2: right, 3: up
        '''
        direction = some_function(self.game)
        return direction

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.

For EE369 / EE228 students from SJTU

Please read course project requirements and description.

About

Educational API for developing ML (imitation learning or reinforcement learning) agents to play game 2048

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 80.2%
  • JavaScript 16.1%
  • Python 1.2%
  • C++ 1.0%
  • Shell 0.9%
  • C 0.3%
  • Other 0.3%