An old time game Tic-Tac-toe

Overview

A Tic Tac Toe Bot

tictactoe

This is the code repository for my article on Medium - Playing Games with Python - Tic Tac Toe, where I have tried to take the famous Tic-Tac-Toe game and create a bot proficient enough to beat human players, if not the game itself.

What's inside this repository?

  • A fully playable Tic-Tac-Toe environment.
  • A bot trained using Temporal Difference learning (A technique in Reinforcement learning).
  • A bot trained using the Minimax Algorithm.

How to use this ?

Play against the RL bot

run python testing_(HumanvsAI)_ReinforcementLearning.py

Play against the Minimax bot

run python HumanvsAI_Minimax.py

Play against another human player (Regular tic tac toe)

run python HumanvsHuman.py

Training the RL Bot

Out of the two implementations, only the RL bot needs to train in order to reach proficiency. It does so by play 1v1 with another RL bot sharing the same state values in order to learn to beat itself and eventually become better. The num_iterations parameter controls the number of games that will be played among the bots.

run python training_(AIvsAI)_ReinforcementLearning.py

Testing the two bots by making them play among themselves

I wrote anotherr script in order to see which bot performed better in very brutal 1v1 fashion. The num_iterations parameter controls the number of games that will be played among both the bots.

run python Showdown_Minimax_vs_RL.py

To Try

  • Minimax Algorithm
  • Temporal Difference Learning
  • Q Learning
  • Genetic Algorithms
You might also like...
Tic-Tac-Toe Game in python3 Tkinter
Tic-Tac-Toe Game in python3 Tkinter

Tic Tac Toe Tic-Tac-Toe Game in python3 Tkinter About: Tic Tac Toe or Noughts and Crosses as called in British is a pencil and paper game for two play

Tic Tac Toe Game build with Python
Tic Tac Toe Game build with Python

Tic Tac Toe Game Description two players who take turns marking the spaces in a three-by-three grid with X or O. The player who succeeds in placing th

This is a simple Tic Tac Toe game built with Python.

This is a simple Tic Tac Toe game built with Python.

Open source Board Games Like Tic Tac Toe, Connect 4, Ludo, Snakes and Ladder etc...

Board-Games What to do... Add Board games like Tic Tac Toe, Connect 4, Ludo, Snakes and Ladder etc... How to do... Fork the repo Clone the repo git cl

Tictactoe py tkinter canvas - Tic Tac Toe written in Python 3 with tkinter mainly using canvas

Python 3 Tic Tac Toe with tkinter This is a tkinter version of my Tic Tac Toe ga

A DDQN that learned to play tic tac toe by playing against itself
A DDQN that learned to play tic tac toe by playing against itself

TicTacToeAI A DDQN that learned to play tic tac toe by playing against itself Cu

Abandoned plan for a clone of the old Flash game Star Relic

space-grid When I was in middle school, I was a fan of the Flash game Star Relic (no longer playable in modern browsers, but it works alright in Flash

Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

A set of functions compatible with the TIC-80 platform
A set of functions compatible with the TIC-80 platform

Pygame-80 A set of functions from TIC-80 tiny computer platform ported to Pygame 2.0.1. Many of them are designed to work with the NumPy library to im

Owner
Jigyanshu
AI/ML ENTHUSIAST..
Jigyanshu
Rudimentary CMD based implementation of the Tic Tac Toe game

Packages used: questionary random os (Requires Python >3.8 as walrus operators are used in the script) Contains the .py file (tictactoe.py) and an exe

Ashwin 1 Oct 15, 2021
Input-based tic tac toe game made in only python.

Tic Tac Toe Tic Tac Toe is a game in which two players seek in alternate turns to complete a row, a column, or a diagonal with either three O's or thr

Ayza 5 Jun 26, 2022
This is a simple Tic-Tac-Toe game.

Tic-Tac-Toe Nosso famoso e tradicional Jogo da Velha, mas agora em Python. Development setup Para rodar o programa, basta instalar python em sua maqui

João Assalim 1 Oct 10, 2022
Tic tac toe game developed by naman in python

TIC TAC TOE GAME DEVELOPED BY NAMAN IN PYTHON . IT USES MINMAX ALGORITHM TO COMPETE IN DIFFICULTY MODE

Naman  Anand 4 Jun 24, 2022
This is a simple tic tac toe game that runs in the command line.

Tic Tac Toe Game This is a simple tic tac toe game that runs in the command line. Game Description: The game is made up of a square grid with 9 portio

Josias Aurel 2 Nov 12, 2022
Just a simple Tic Tac Toe game, built with Python

TicTacToe Author: Gabriel Lima Table of Contents About Getting Started Linux Windows About This is one of the first projects I built when I first star

null 1 Nov 28, 2021
Tic Tac Toe game developed in python; have 2 difficulty levels

Tic Tac Toe Game This is a code for Tic Tac Toe game in python. Game has 2 difficulty levels. Easy Hard To play the game, use this command in a LINUX

Akshat Mittal 1 Jun 25, 2022
Quantum version of the game Tic Tac Toe.

QTicTacToe Quantum version of the game Tic Tac Toe. This game was inspired by the game at this site. Installation The game requires the qiskit python

null 1 Jan 5, 2022
Tic Tac Toe Python Game GUI

Tic Tac Toe is one of the most played games and is the best time killer game that you can play anywhere with just a pen and paper.

Astitva Veer Garg 1 Jan 11, 2022
A Python tic tac toe game

Tic Tac Toe A Python tic tac toe game To start the game, run python3 main.py First, you have to select the game level. Today, it has three levels In a

Phant 1 Jan 14, 2022