Eashwar-22 / Tic-Tac-Toe

Tic Tac Toe implemented on Python using ANN with tensorflow and keras

Home Page:https://www.notion.so/Creating-an-AI-TicTacToe-Bot-2f10a25317f14b8da3c6ba93f6e1d61b

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tic Tac Toe

Objective :

  • Replicate the game with two modes - Human vs Human & Human vs Computer.
  • Human vs Computer is implemented using ANN based on the data generated by Human vs Human mode. The idea is to mimic human gameplay without the need for algorithms like Minimax to predict the possible moves.

Setback :

  • Generalisation of the deep learning model depends on how much the Human vs Human mode is being played as more data is needed from that.
  • Hence, the model takes time to generalise results - developing each of them by versions.

Steps Actions Development
Game Human vs Human mode is complete Deployment in pygame module is needed
Human Data Generated on the go Need atleast 1000 rows of data for first gen model to generalise
Training
Implementing Human vs Computer

Sample Data (in one Human vs Human session)
Note : 1 session can contain multiple games.

Screenshot 2021-11-28 at 1 41 15 PM

Description

Column Description Comments
player X's or O's turn to play
win Flag=1 if the game has been won following the player's move The flag remains at 0 until the win occurs or if there is a draw
1_played to 9_played Represents the cells 1 to 9 in the TicTacToe board 1 if X has already used that cell,
-1 if O has already used that cell
Note : Even the cell at the current player's turn is updated in the same row.
1_threat to 9_threat Represents the possible cells that could bring the loss to the current player if the opposition uses one of these flagged cells in the following turn. 1 for cells that could end the game if the opposition uses them in the next move else 0
1_win to 9_win In contrast wrt the previous 9 columns, these cells represent the potential of winning if the player uses one of the flagged cells in their next tun. Eg: cell 9 is flagged as 1, if the same player uses cell 9 in the next turn he/she could win the game. But of course this could be disrupted if the opposition comes up with a different play.
next_move Cell number used in the next turn. After every game session the rows are shifted by 1 that in each row it represents the next possible move based on the historical data This is the cell to be predicted by the bot during Human vs Computer session.

About

Tic Tac Toe implemented on Python using ANN with tensorflow and keras

https://www.notion.so/Creating-an-AI-TicTacToe-Bot-2f10a25317f14b8da3c6ba93f6e1d61b


Languages

Language:Jupyter Notebook 77.6%Language:Python 22.4%