Git Product home page Git Product logo

reinforcement-learning-tic-tac-toe's Introduction

reinforcement-learning-tic-tac-toe

An RL agent that learns to play Tic Tac Toe through value iteration. Inspired by Sutton and Barto's, "Reinforcement Learning - An Introduction". Can train an agent through self play, and then test that policy against a human. A human can directly play against an agent.

Usage

  1. Install requirements pip install -r requirements.txt
  2. Run the program, python main.py

Program Structure

This program was designed using OOP principles. A description of files is below.

  • main.py - main program - run this from your terminal python main.py.
  • board_state.py (class) - manages the state of a TicTacToe game.
  • agent.py (class) - an autonomous agent that will make decisions based on a policy and learn through value iteration.
  • human.py (class) - helper class so that a player may interact with the game.
  • game.py (static class) - play the game, determines if a game is over, and prints board state to the console.

Extending This Work

Right now, an agent learns through TD(0) learning and value iteration. In order to acheive an optimal policy the agent must have been in each state multiple times. Although the state space of tic tac toe is relitively small compared to other games, through my experience this approx 200k iterations to train an optimal agent. Other approaches such as q-learning, DNN's and even non RL approaches are encouraged, such as game theory or evolutionary approaches. Forks, & merge-requests are encouraged.

Citing This Work

See LICENSE, if used for academic purposes, please cite this repository.

reinforcement-learning-tic-tac-toe's People

Contributors

artificial-agent 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.