tic tac toe optimal move

Tic-Tac-Toe Python AI

A brute force approach to Tic Tac Toe

 

I have just created a fully working Tic-Tac-Toe AI which will never lose! It was an extremely interesting project as it helped me understand the concepts of recursion and the minimax algorithm. All the code in the project is available for download HERE.

To make this binary opponent of ours truly unbeatable I had to use a very useful algorithm which would allow the computer to calculate all possible moves and select the best one. This is known as a Shannon Type A algorithm as it uses a brute-force strategy to find the optimal play.

Continue reading →