Skip to content

The tic tac toe game with an monte carlo tree search.

Notifications You must be signed in to change notification settings

ipmach/TicTacToe_IA

Repository files navigation

Tic Tac Toe IA game

Game of the tic tac toe with different IAs to play with. This code was made just for fun and to give a start point for future implementations of new algorithms. The game has a graphic interface, a terminal one and a statistic one, they can be played with different board sizes (3x3,4x4..).

The code is done in Python 3.7 and the actual IAs implemented are Monte Carlo Tree Search a heuristic algorithm use in Alpha go, Q-Learning an reinforcement learning algorithm, Minimax, and a simple heuristic algorithm.

video

(Click in the image to watch the video)

Play game

-Terminal interface:

  • size: board size.
  • trains_steps: train steps in each iteration (MCTS).

-Stadistic interace:

  • Plot the score after x games between two agents.

-Graphic interface:

  • size: board size.
  • trains_steps: train steps in each iteration (MCTS).
  • height: height of the interface.
  • width: width of the interface.
python main.py size

To get a report of a qtable already train.

python check_qtable.py size

Game types

Types of games that can be play.

  1. Player vs Player
  2. Player vs IA
  3. IA vs Player
  4. IA vs IA
  5. IA vs IA stadistics

Code structure

Graph

Implemented IAs

-MCTS: Monte Carlo Tree Search.
-MM: MiniMax, with "alpha beta optimization".
-Q-Learning: Reinforcement learning control.
-Heuristic

Dependecies

Dependecies need it to run the code.

pip install numpy
pip install pygame
pip install matplotlib
pip install pandas
pip install tqdm
pip install pylatex

External code

The code use from other users of GiHub with some modifications.

About

The tic tac toe game with an monte carlo tree search.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages