This is the XKCD tic-tac-toe cheetsheet:
It's rather big, I know. But it's also your most valuable resource in your challenge.
Create a program (in your language of choice) that uses the Optimal Move Cheatsheet (henceforth OMC) to output the optimal move when given a sequence of moves.
Your program will be fed a series of moves in the following fashion:
A3 A2 B2 C2 ...
Where the first combination is always X, the second O, and so on. The letter is the Y coordinate (
A-C, A at the top) and the number is the X coordinate (
1-3, 1 at the left).
You may assume that the given combination is following the OMC's suggestion for each move at least for the player asking for a recommendation. You can also assume that the input will never be null (at least one move has been made). You must:
- Figure out whether the next move is for X or O (you don't need to output this)
- Use the OMC to decide the next move
- Print the next move in the standard format
You may also include the player's chance of winning (as a percentage) for 50 character discount on your score.