3D Tic Tac Toe
Artificial Intelligence, is definitely one of my interests. Sure, it will take over the world one day, but it’s so much fun to play with.
My first exposure to artificial intelligence was in a computer course on Data Structures and Algorithms. As part of an assignment, we were tasked with creating a 3D tic-tac-toe program—challenging enough on its own—but we also had to program the computer to act as the opponent. Oy vey! The idea of a computer-controlled opponent seemed completely baffling. How do you make the computer play against you? Figuring out how to accomplish this is what sparked my fascination with artificial intelligence.
Here is my C implementation of a 3d tic-tac-toe playing algorithm hosted on GitHub at TicTacTocToeEngine. The code is made to compile on any unix system, use the included make file to compile.
The program uses a board evaluation function and a simple depth-first search algorithm to find the “best” move for any given board position. The depth-first algorithm is often used as a primer for computer opponents in turn based strategy games like checkers, chess and many others.
Example Usage:
Here is a sample of an App that might use this type of algorithm. Here you have the Tic Tac Toc Toe at Apple’s App Store, available for both iPhone and iPad platforms. Give it a try and let me know what you think!
Tic Tac Toc Toe an iOS App

And, if you would like to explore this type of programming for yourself, the Tic Tac Toc Toe AI code os available on GitHub. Try it. Learn from it. Enjoy!