Skip to content

Train agents to play the game 2048 using reinforcement learning.

Notifications You must be signed in to change notification settings

Valentin-Laurent/Year-2048

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Here we train agents to play the game 2048 using reinforcement learning, thanks to the Tensorforce library. The code has been pushed during an intense 2 weeks-long project, so this repo could use some cleaning (I've started working on it) :)

See the main training notebook for a nice overview of our work. You can also watch the demo of our project in this video, where I give an introduction to RL and an analysis of our results (8 minutes, in french).

We trained our best agent using Deep Q-Learning. It reaches the 1024 tile in about half of the games it plays, and the 2048 tile every 20 games or so. Below is an extract from a game it played:

GIF of our best agent playing 2048

Set up

Clone this repository and install the dependencies (you may want to create a virtualenv first):

git clone [email protected]:Valentin-Laurent/Year-2048.git
cd Year-2048
pip install -r requirements.txt

Quickstart

You can use the main training notebook to train an agent on your own. The agent params, metrics, and the agent itself will be saved in the notebooks/data folder. A single file will store all the training and testing metrics of all of your agents, and a single file will store the params of all of your agents. However, one folder per agent will be created in order to dump it.

You can also load existing agents to further train them, possibly with different params. A dump of our best agent is available for you in the best_agent folder!

Feel free to have a look at our other notebooks in notebooks/drafts. Please note that we use our own custom gym-2048 environnement to train agents.

About

Train agents to play the game 2048 using reinforcement learning.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published