Chapter 5Ghost in the Machine

So far we’ve created a game that lets the user make moves by touching the screen and alternating between the X and O players. In this chapter we’re going to turn Tic-Tac-Toe into a single-player game, where the human makes a move and the computer responds.

To do this, we need to teach the app how to evaluate positions on the game board and choose the best move from all the ones available. This will require that we take a quick detour into the world of AI (artificial intelligence).

Get Hello, Android, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.