Skip to content

OpenGenus/tic-tac-toe-rl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

tic-tac-toe-rl

Project Description

A classic Tic Tac Toe game requires two players to play. In this project, one of these players are an agent who learns to play through reinforcement learning method. Another player chooses random moves. Some methods are added to visualize the game as the players play and a graph shows the progress of the agent compared to the random player. Tkinter is used for this project o build the board and access it easily as it provides the grid functionality.

Project Created With

  • Any Python supported IDE
  • Python
  • Tkinter
  • Numpy, Random, Time, Matplotlib, IPython

Setup

  • Install Python
  • Install and import all(*) from Tkinter
  • Install and import Numpy, IPython, Matplotlib
  • Install and import any other libraries necessary

Run File

The tic-tac-toe file contains three classes for both of the agents and the game environment. After running the file, the game will proceed on its own as the agent and te random player keep playing. There will also be a graph to visualize the scores to the number of games played. The symbols are fixed for the players. The random player has the 'O' symbol and the agent has the 'X' symbol.

Limitations

The grid doesn't completely show. The moves of the players appear with a border around them. The game doesn't shutdown with keyboard interrupt, the terminal needs to be deleted or killed. The starting player is always the agent.

References

  1. https://github.com/mudasiryounas/tic-tac-toe-game-reinforcement-learning
  2. https://github.com/Munfa/2048-python
  3. https://github.com/patrickloeber/snake-ai-pytorch

Results

The gameboard

unnamed (1)

The graph; here, the blue line represents the agent and the orange line represents the random player

unnamed

Scores after each game

unnamed (2)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages