Git Product home page Git Product logo

alphafour's Introduction

AlphaFour

AlphaFour is a Connect Four AI built with Python and Pytorch, that selects moves using a nerual network and a Monte Carlo search tree similar to DeepMind's AlphaGo and AlphaZero. Connect is a solved game, so this might be too easy for a computer, but it's a way to get my feet wet before trying chess.

Getting Started

To play a game, simply run:

python play_game.py [-p1 <agent1>] [-p2 <agent2>]

-p1 and -p2 allow you to specify the Agent used for player one and/or player two respectively, with player one making the first move. The following player types are available:

  • AlphaBeta: Basic algorithm that uses alpha-beta pruning to choose the next move.
  • Human: Rather than automatically suggesting moves, the agent will prompt the user for the next move. Allows you to play against the AI, or with a friend if you really want to play connect4 and can't be bothered to go out and buy a board.

By default, play_game.py will start a game with a Human as player one, and AlphaBeta as player two. You can specify either player to override the default behaviour. Examples:

python play_game.py                          // Default behaviour. Human vs. AlphaBeta
python play_game.py -p1 AlphaBeta            // AlphaBeta vs. AlphaBeta
python play_game.py -p1 AlphaBeta -p2 Human  // Give robot first move

alphafour's People

Contributors

bengholmes avatar

Stargazers

 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.