Coder Social home page Coder Social logo

roth1002 / 2048-nn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tjwei/2048-nn

0.0 1.0 0.0 138.38 MB

A Deep Learning AI for 2048 (2048:94.15%, 4096:78.48%, 8192: 34.5% 16384: 0.177%)

License: MIT License

HTML 6.90% JavaScript 44.75% CSS 48.34%

2048-nn's Introduction

A 2048 Deep Learning AI (that does not suck)

I didn't think neural network is particularly suitable for solving 2048 puzzle, but I implement one anyway. Turns out the result is not too bad, at least much better than I expected.

See it in action http://tjwei.github.io/2048-NN/ and in Video https://www.youtube.com/watch?v=oRC2W38lxIE

Nueral Netowrk AI for the game 2048.

It is a fork of http://ov3y.github.io/2048-AI/ and replace the AI part by a neural network.

The neural network is pretrained using Theano and lasgane by observing simulated games and supervised by an advance AI https://github.com/nneonneo/2048-ai

The trained neural network can achieve 2048+ in >94% of the games. It reaches 4096 in >78% of the games and reaches 8192 in >34% of the games There is a small chance(0.1%~0.2%) the AI can reach a max tile of 16384.

It may sometimes ended with an embarrassingly low score.

The following is the result of 100K games played by the neural network

max tile % of games accumulated % reversed accumulated %
16384 0.177% 0.177% 100.000%
8192 34.500% 34.677% 99.823%
4096 43.819% 78.496% 65.323%
2048 15.656% 94.152% 21.504%
1024 4.340% 98.492% 5.848%
512 1.144% 99.636% 1.508%
256 0.261% 99.897% 0.364%
128 0.064% 99.961% 0.103%
64 0.026% 99.987% 0.039%
32 0.007% 99.994% 0.013%
16 0.005% 99.999% 0.006%
8 0.001% 100.000% 0.001%

or in graph

The average score is 85351.8 and the average length of a game is 3733.6 steps.

The following graph shows how many games left after certain steps in the 100K simulations:

The graph indicates that the AI performs relatively weak in early stage of the game.

Without the help of human made features and heuristics like what is used in https://github.com/nneonneo/2048-ai , the network can still reaches at least 75% success rate for the same network architecture.

A much smaller model trained without using any human made features and heuristics reaches 47% of success rate, can be found at http://github.ocm/tjwei/rl/

The animationDelay is set to 10. You can make it run faster or slower with a different delay time.

2048-nn's People

Contributors

aumo avatar christianbundy avatar gabrielecirulli avatar moverlan avatar nguydavi avatar ov3y avatar resir014 avatar tjwei avatar

Watchers

 avatar

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.