Noughts and Crosses

This is a working example of the Minimax algorithm as described in the Game Trees chapter in the New Turing Omnibus. The computer opponent uses the Minimax algorithm to determine its best possible move. If this has been programmed correctly, you will never win (sorry).

When the compuer has a choice between multiple "best moves", it prefers to take the move that results in a faster win or a prolonged loss for itself. This is achieved by biasing the evaluation of positions according to how many squares remain.

At present, this application does not implement alpha-beta pruning which would significantly reduce the number of comparisons required during the Minimax algorithm. As a result, the first move the computer makes is noticeably slower than subsequent moves.

Written by Chris Patuzzo, View the code on GitHub