Coder Social home page Coder Social logo

tic-tac-toe_qlearning's Introduction

Executing the code

To run the game, execute main.py script as

python main.py --Train 'F'

The position of the array is to be entered as the input where we want to place the 'X'. The format to be entered is 1,2.

Postion on the board to be entered are as follows:

0,0 0,1 0,2
1,0 1,1 1,2
2,0 2,1 2,2

Training of the game can be executed by

python main.py --Train 'T'

Implementation

The system learns the game by playing against the other Q learning player. The player who makes the first move is selected at random. There will be two training sessions, one for the bot playing as 'X' and the other for the bot playing as 'O' against the human. So when the Q table is made for the bot playing as 'X', the other player in the training session will have a higher exploring rate, which makes it more probable to make moves at random. This is done so that the other bot learns all the states possible. If both players in the training session have same exploring rate then the bot doesnot learn few moves.

The plots of the number of wins, loses, ties and invalid moves over the number of episodes is given in the below figures. From the graphs we can observe that as the number of episodes increases, loses and ties saturate. On the other hand wins and ties keep increasing proportionally. The plots are in the order of wins, loses, ties and invalid moves.

tic-tac-toe_qlearning's People

Contributors

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