Creating the Tic-Tac-Toe Example

Everybody knows how to play Tic-Tac-Toe: a 3×3 array of tiles, initially empty, is filled in by two players who mark either an X or an O in an empty spot. The first player to get three of their marks in a row wins. If the board fills up first, then that’s a tie and nobody wins.

Ultimate Tic-Tac-Toe[28] is similar, except that you can’t simply put a mark in your square—you have to win the square by playing a nested game of Tic-Tac-Toe using a 3×3 array of smaller tiles inside the big one. See the figure for an example.

images/fig.gameactivity.png
Figure 2. Tic-Tac-Toe meets Inception

There are many variations, but we’re going to use the one ...

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.