Developing a Gameplay Strategy
NEXT YEAR: If this does end up in a different unit than the above, we should include some kind of review like what's on page 1. --MF, 6/7/18
On this page, you'll define the strategy that the computer will use by investigating the strategies that humans use.
You've already built into your project the most basic Tic-Tac-Toe strategy rule: the computer will move to the best empty square
on its turn. But there are other important elements to a good strategy...
- Play a couple games of Tic-Tac-Toe with your partner on paper, and pay attention to the strategy you use.
- Discuss your strategy with your partner, and write out a list of if/then rules that you both use to play (for example, "if such-and-such is the case, then play here").
The strategy rules for Tic-Tac-Toe have different degrees of priority. For example, the most important rule is "if I can win on this turn, then play in the winning square."
- What's the second most important rule?
-
Think through how the computer can determine if a player can win on their next turn. The won?
block works by looking for a triple in which all three slots are X or all three slots are O. Describe what the slots of a triple will contain if player O can win on their next move by filling that triple's last square.
These three rules (if you can win on this move, do so; if the other player can win on their next move, block them; and otherwise just pick the best empty square) are part of most human Tic-Tac-Toe strategies. But the best players develop additional rules that come after the first two but before the last. You can explore some of these rules in the Take It Further problems at the end of the lab.