Playing Against Computer with AI (Advanced) Click the image to run the demo for the various AI strategies (under the "Options" menu): Tic-tac-toe seems dumb, but it actually requires you to lookahead one opponent's move to ensure that you will not loss. That is, you need to consider your opponent's move after your next move. For example, suppose that the computer uses 'O'. At (D), the computer did not consider the opponent's next move and place at the corner (which is preferred over the side). At (E), the opponent was able to block the computer's winning move and create a fork.
Read full article from Tic-tac-toe AI - Java Game Programming Case Study