Using simple and blind rules, what is the best tic-tac-toe player you can make?
I got on a kick trying to make tic-tac-toe computer players that lose, but don't just flop around on the floor... With that in mind, I've come up with a number of interesting abstractions, and a short puzzle for the interested reader. First we'll start by defining some properties of the board:
- The Center is given the value 4
- The Corners are given the value of 3
- The Edges are given the value of 2
- All values represent the number of winning pattens presented by a certain board location.
Next, we'll define some simple rules that I'll use in my tic-tac-toe player. The rules are processed in the order given. So each time it is the computer's turn to play they'll start at the top and go to the bottom.
- Win - Place a winning piece if available.
- Block - Place a blocking piece if need be.
- Highest - Pick the highest open board position.
The above tic-tac-toe player is actually pretty good. As long as they play the above rules exactly, I believe there is only one way to beat them. That is both allowing them to place the first piece or the second piece. It isn't the smartest player, because it doesn't optmize it's own winning patterns, but it is a decent player. See if you can submit the game where it loses!