Giter Club home page Giter Club logo

2048's Introduction

Winning strategies of 2048

This is a work in progress!

The goal of this project is to explore reinforcement learning strategies on the game 2048. 2048 is a game where on a 4 x 4 grid, you have the options of moving up/down/left/right in order to merge tiles, which are canonically multiples of 2. The goal is to merge enough tiles to create the infamous 2048 tile.\

While there have been some interesting work on AI-techniques of 2048, this work often focuses on identifying high score/optimal score strategies. The following implementation hopes to address this question, along with another: "how do we face non-optimal choices?". In particular, there are many board configurations where a priori, we may not have the optimal choice.

As I populate this project, I will be identifying different milestones.

At the moment, the implemented GUI version of the game works, as does a crude Q-learning approach to training. The model roughly plays 600 games/minute with Q-learning, but memory can become a problem after 44K games, as the state-dictionary can be quite enormous.

2048 Game [game/]

Under this folder is the rules, constants, and GUI-variant of the game. The following files are as such:

  • rules.py: Class to construct an instance of a playable 2048
  • constants.py: Parameters to visualize the gameboard
  • gui2048.py: A playable version of 2048.

To play an interactive version of the game, the command python game/gui2048.py should be sufficient.

Learning environment [gym-2048/]

To make the environment, cd into gym-2048 and pip install -e . in that directory. These directories have the correct substructure to leverage gym, a python reinforcement learning tool.

Model AI [ai/]

This folder contains attributes to successfully train and implement a model with reinforcement learning. Currently, the only policy-training method implemented is Q-learning.

  • parameters.py: parameters to train model
  • agent2048.py: implementation to load environment and allow visualization of moves made
  • rl_model.py: currently implemented Q-learning training objective.

Credits

2048's People

Contributors

hakunanatasha avatar murakdar avatar

Stargazers

Roman avatar Alex Larsen avatar

2048's Issues

Experiments

This high-level issue tracks planned experiments and their progress. @hakunanatasha please add or adjust as you see fit!

Computational experiments

  • how many moves does it take to reach the score of 2048?
  • which spaces are most "valuable"?
  • how do different training policies bias the resulting choices?

Human experiments

  • what circumstances result in people making sub-optimal choices?
  • are certain board states more difficult to reason about?
  • what common strategies do people use (e.g. place in corner)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.