Tic Tac Toe

Back to projects list

CanvasGame searchHTML UI

Tic tac toe is a great first project for buildng a simple UI in either Canvas or HTML and also for starting to explore game search, the algorithms used to write programs thay play strategy games ranging from tic tac toe to chess and go.

The simplest version of this project is just a board that lets two human players play against each other. It should enforce the rules (no playing in an already marked square) and should be able to detect when one player wins.

A more elaborate version of the project would allow a human to play against the computer. You can try writing a computer player using heuristic rules (always go in the center if it's available, etc.) or you can experiment with brute force searching. Or if you are interested, I can teach you about a technique that allows you to precompute a perfect tic tac toe player using the same techniques that computer chess programs use to play perfect endgames.

Taking it further Tic tac toe is pretty boring, as a game. However there's a variant Ultimate Tic Tac Toe that is quite a bit more interesting but should be relatively easy to implement once you've written normal tic tac toe. As with all game projects you can start with a human-vs-human UI and then, if you wish, explore writing a computer player.

References