This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Chapter 11 TicTacToe Magic Three simple games are related in a surprising way. And, the programming of the game play is instructive. The first of the three games is Pick15. Harold Stark, who was then at the University of Michigan, told me about the game in the late 1960s. I suspect that this is the first time you have heard of it. The game involves two players. You start by listing the single digit numbers from 1 to 9. You then take turns selecting numbers from the list, attempting to acquire three numbers that add up to 15. Each number can be chosen only once. You may eventually acquire more than three numbers, but you must use exactly three of them to total 15. If neither player can achieve the desired total, the game is a draw. For example, suppose that Green and Blue are playing. They start with the list. List : 1 2 3 4 5 6 7 8 9 Green : Blue : Suppose Green has the first move and chooses 8. Then Blue chooses 4 and Green chooses 2. Now Blue should respond by choosing 5 to prevent Green from getting 2 + 5 + 8 = 15. Here is the situation after the first two rounds. List : 1 2 / 3 4 / 5 / 6 7 8 / 9 Green : 2 8 Blue : 4 5 Copyright c ⃝ 2011 Cleve Moler Matlab R ⃝ is a registered trademark of MathWorks, Inc. TM October 2, 2011 1 2 Chapter 11. TicTacToe Magic Now Green chooses 6 to block 4 + 5 + 6 = 15 from Blue. This is actually an advantageous move for Green because it gives her two different ways to win, 1+6+8 and 2 + 6 + 7. Blue cannot block both. If Blue chooses 7, then Green chooses 1 to win. If Blue chooses 1, then Green chooses 7 to win. The final position might be List : 1 / 2 / 3 4 / 5 / 6 / 7 / 8 / 9 Green : 2 6 7 8 Blue : 1 4 5 Note that Green also has 7+8 = 15, but this does not count because there are only two numbers in the sum. Figure 11.1 shows the starting position for the Pick15 option in our Matlab tictactoe program. When you play against the computer, your moves are shown in green and the responses from the program are shown in blue. Figure 11.1. Starting position for Pick15. Figure 11.2 shows the position for our example game after two moves from each player. Green now has to choose 6 to block Blue. Figure 11.2. Position after two moves from each player. Figure 11.3 shows the final position for our example game. Green has won with 2+6+7 = 15. Figure 11.3. Final position for Pick15. Please take time out from reading this chapter to try this game a few times yourself, playing against a friend on paper or against our Matlab program. I think you will find that Pick15 is more challenging than it sounds at first....
View
Full Document
 Spring '11
 8

Click to edit the document details