Introduction

Tic Tac Toe is a two-player, turn-taking, perfect information, zero-sum game. Perfect information means that both players can see every element of the game and there are no random or hidden elements. Zero sum means that there are no possible win-win situations in the game.

The rules of Tic Tac Toe are: To win, a player must have three of their letters in a diagonal, vertical, or horizontal line. If the board is full and neither “X” nor “O” has won, the game is a draw.

Play a game here against a random opponent or a friend. Alternatively, you can watch the computer battle itself randomly!

You may have noticed the WOPR button above. It is a reference to the movie War Games, in which an AI , “Joshua”, poised to destroy the world through nuclear war, was stopped when it was made to play tic tac toe against itself. It ultimately determined that a perfectly played game of tic tac toe, like nuclear war, has no winners!

In this project, I will analyze tic tac toe and then build two different AIs to play the game. All the code can be found at my github repository. But before we get to that, enjoy Mathew Broderick!