Tic Tac Toe Algorithm

Now we know how to detect, grab, and move a game piece. Next we need to learn how to play Tic Tac Toe. The associated solution, TicTacToe.sln, is located in the TicTacToe folder (http://code.google.com/p/robotic-tic-tac-toe-lynxmotion/source/browse/trunk/#trunk/TicTacToe). The game algorithm code in the TicTacToe.Logic project is inspired by the code that Jonathan Haywood posted on his blog (Tic-Tac-Toe Using Minimax and ASP.NET). Thanks Jon! Please see Jon's blog for additional information about the Minimax algorithm.

As a simple way to test the code I added a small WinForm application that allows a user to play against the computer (project TicTacToe.UI). The user makes a move by clicking on the desired field. The user's moves are drawn as crosses, the computer's moves as blue circles:

I only used the app for testing purposes and as such the app is not polished at all.

Last Updated Tuesday, 22 December 2009 21:31


Apr 4, 2010
Category: Robotics
Posted by: rainer
A new article about the Monte Carlo Localization algorithm is now available in the robotics section.
Jan 2, 2010
Category: General
Posted by: rainer
Information about ongoing projects will be available on my blog.
Dec 24, 2009
Category: Robotics
Posted by: rainer
Detailed information about my Tic Tac Toe playing robotic arm is now available under the Robotics section.