This is a simple analysis of the game of tic-tac-toe. Although tic-tac-toe is an extremely limited game in terms of depth (up to 9 moves) and breadth (up to
I chose to use Go since it is fast and also since I wanted to represent the board state in a single 32-bit unsigned integer. This allows for fast hashing of the board to test if it is identical to another board state. This is done by rotating the board four times and remembering the minimum integer value of the board.
The board is used to build a decision tree, and that tree can then be used with various path finding algorithms to find the optimal move, such as MiniMax.
The resulting tree is exported to a .dot file and can be converted to a PDF/PNG/file of your choice via GraphViz's dot
program.
I am not good at Go, so the code could be cleaned up a bit.
My function to rotate a board clockwise or counterclockwise is dumb (manually swaps all eight values around the center of the board) but works for a 3x3 board.
I need to make it so that you can actually play against the decision tree.
I want a way to export the decision tree so you can play against it.