Coder Social home page Coder Social logo

b7leung / reinforcement-learning-connect-four Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 80 KB

AI that learns to play connect four, using reinforcement learning methods (Q-Learning and Monte-Carlo policy iteration).

Python 17.64% Jupyter Notebook 82.36%
reinforcement-learning connect-four

reinforcement-learning-connect-four's Introduction

image

An AI that learns to play connect four, using reinforcement learning. For details, please refer to the report.

  • connect_four.py: The code for the connect four game mechanics, including managing the board state, updating it with a move input, and checking for win conditions (ie, if the current board states has a vertical, horizontal, or diagonal four in a row, as well as if the board state is a tie)

  • q_learning.py: The code for learning the Q function for the Connect Four AI. Contains the code for generating episodes with self-play. Also contains code for the main training loop (ie, implementing the MC-TS and Q-Learning algorithm) and testing the trained Connect Four AI.

  • run.py: Used to actually start the RL experiments.

  • Plots.py: A jupyter notebook used to plot the results.

Note: For the code to be runnable, the matplotlib, numpy, pandas, and tqdm python packages are required. Also, clone the github repository from https://github.com/codebox/connect4. The code from this repo is used solely for evaluating my trained RL Connect Four agent at test time, as a black box. It is not used for the training, or anything reinforcement learning related (all the things related to RL is implemented by me).

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.