Giter VIP home page Giter VIP logo

threesai's Introduction

ThreesAI is an implementation of the game Threes ( http://play.threesgame.com/ ) in Python 3 for training neural nets to play, and includes a pretrained net that performs better than random at Threes.  There remains room for a significant improvement in the AI.

ThreesAI requires Python 3, as well as keras, numpy, sys, tty, termios, and csv.

The threesAI.py file contains the overall management code that handles both the game object (threesOOP) and either the AI object (AIOOP) or the input from a human player.

To play a game of Threes on the command line using human inputs, run:

python3 ./threesAI.py

Use the arrow keys to make moves, and hit 'q' three times to quit the game early.


To have the current AI model play 1000 games and report basic summary stats of its results, run:

python3 ./threesAI.py ai

The game records the scores of all of its games in the most recent run in the file gamesHistory.csv if you're interested in running more robust statistical analyisis of its performance.


To train a new AI model, run:

python3 ./threesAI.py ai new


To add training games to the existing model, run:

python3 ./threesAI.py ai train


Lines 20 - 24 of AIOOP.py contain different ways to automate move generation.  Only one of these lines should be uncommented; by changing which one, you can explore the performance of several nieve strategies at Threes and compare them to your Neural Net.  Getting the Neural Net to perform better than random has proven extremely straightforward.  

threesai's People

Contributors

dericmiller 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.