Slowly building to a climax
What we very nearly have now is a functional Tic Tac Toe game for two players. Why waste money on a paper and pencil, when you can spend hundreds or thousands of dollars on a computer to play Tic Tac Toe?
Two human players can see for themselves whenever X or O gets 3-in-a-row and wins the game, but ideally, the game will be able to check for a win through code. We don't quite have the right elements in place to detect a win state, but we're going to spend the rest of the chapter getting there.
Have a go hero – think it through
Ask yourself: what does the code need to know in order to determine when a player has won? How would you go about figuring that out? Put the book down for a moment and puzzle through this question, because it's exactly the type of problem you'll face when you begin building your own games.
I strongly urge you not to keep reading at this point. This isn't like one of those kids' shows where the little Mexican girl says "flap your arms like a...