Stat 155: solutions to midterm exam Michael Lugo October 21, 2010 1. We have a board consisting of infinitely many squares labeled 0, 1, 2, 3,... from left to right. Finitely many counters are placed on these squares. A game is played, in which a move consists of one player moving a counter to the left, subject to the following rules: no counter can jump over another counter; it is not allowed to have two or more counters on the same square. The last player who is able to move wins. Say we have counters at positions 5, 8, 11, 15, and 22, as illustrated below. Find all winning moves. Solution. We discussed this in class on Wednesday. This is Nim in disguise. The gaps between counters correspond to piles. But a move in Nim should only alter a single pile, so we consider only every other gap, starting from the right. These gaps are of length 6 (between 15 and 22), length 2 (between 8 and 11), and length 5 (to the left of 5). In this disguise we re allowed to make all the moves that are possible in Nim, plus some other moves (which make piles bigger). But all the pile-enlarging moves are reversible. So we need to find winning moves from the Nim-position (5, 2, 6), where moves that enlarge piles are allowed. There are three: Take 5 to 2 6 = 4; Take 2 to 5 6 = 3; Take 6 to 5 2 = 7. These correspond to moving counters from 5 to 4; from 8 to 7; from 15 to 14. Comments. Nobody got this in full! A lot of people proceeded to treat this as the Nim position (5, 8, 11, 15, 22) and found the only winning moves, which was to take 22 to 9. Some people noticed that gaps were important but failed to notice that only the odd gaps mattered, and therefore analyzed the Nim-position (5, 2, 2, 3, 6); a few even saw that a move would change two piles at a time. Some people considered the game where it s only allowed to move a single square to the left. 1
This game is called the silver dollar game with no silver dollar and you can play it online at http://www.cut-the-knot.org/curriculum/games/nosilverdollar.shtml Grading. I had the following rubric in mind: 4 points for the importance of gaps 4 points for recognition that only every second gap matters 3 points for somehow getting a Nim-position (the correct one is (5, 2, 6)) 4 points for finding the value of this Nim-position 5 points for finding the winning moves from this Nim-position 5 points for converting them back to moves in the original game and approximately followed it, but it turned out to be hard to enforce as a lot of people didn t make the initial steps. Roughly speaking, scores from 15 to 20 ended up indicating a correct analysis of the wrong game. Grade distribution: 25: 0. 22-24: 0. 19-21: 2. 16-18: 21. 13-15: 14. 10-12: 10. 7-9: 3. 4-6: 2. 1-3: 5. 0: 2. Mean 12.7, median 14, SD 5.4. 2. Consider the following two-player game. There are n piles of chips containing x 1, x 2,..., x n chips respectively. A move consists of removing 1, 2, or 6 chips from a single pile. The game ends when there are no more chips, and the last player to move wins. (a) What is g(x), the Sprague-Grundy function for a pile of size x, for all nonnegative integers x? Justify your answer. (b) Show that the position x 1 = 5, x 2 = 9, x 3 = 13 is a winning position for the first player, and give all the winning moves from this position. Solution. (a) First compute the Sprague-Grundy function: x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 g(x) 0 1 2 0 1 2 3 0 1 2 0 1 2 3 This pattern repeats with period seven, so g(x) = 0 if x is of form 7k or 7k + 3; g(x) = 1 if x is of form 7k + 1 or 7k + 4; g(x) = 2 if x is of form 7k + 2 or 7k + 5; and g(x) = 3 if x is of form 7k + 6. The calculations we have done suffices because we have seen six repeated elements in a row, and g(x) only depends on elements g(x 6) and later. So g(13), g(14),... only depend on g(7) through g(12). Since these are the same as g(0) through g(5) the pattern stays the same forever. (b) The SG-function of the position (5, 9, 13) is g(5) g(9) g(13) = 2 2 3 = 1. Winning moves are to change one of the 2s to a 1, or the 3 to a 0; these are moves 5 4, 9 8, 13 7. Comments. People generally seemed to have the right idea for this one. In (a) there are really two possible justifications for the answer one is the inductive proof in seven cases, 2
and the other is the argument I gave above. It s not enough to just say Sprague-Grundy functions are eventually periodic although this is true! because you don t know that you ve actually observed the whole period. In (b) there were a lot of people who interpreted (5, 9, 13) as a Nim-position. Grading. Part (a) was worth 13 points, distributed as follows: 4 for the computation 4 for some general statement of the pattern (enough to indicate that if I gave you x, you could tell me g(x)) I gave 2 here for things like it repeats forever. 5 for the justification. To get full credit for the justification you needed to either give the inductive proof (although I was a bit lenient and didn t require people to write out all the cases) or the eventually periodic argument together with an argument for why the data you ve already generated is enough. Part (b) was worth 12, as follows: 4 for determining that the position has value 3; 2 for noticing that 3 is not 0, and therefore this position is a first-player win; 2 for each winning move Grade distribution: 25: 14. 22-24: 5. 19-21: 9. 16-18: 12. 13-15: 9. 10-12: 6. 7-9: 0. 4-6: 1. 1-3: 2. 0: 0. Mean 18.2, median 18, SD 5.9. 3. Solve the two-player matrix game with matrix 2 2 2 1 0 3 4 1 4 2 1 3. 3 1 0 1 Solution. Row 3 dominates row 4. 1/3 of column 1 plus 2/3 of column 3 dominates column 2. 1/2 of row 2 plus 1/2 of row 3 dominates row 1. (There are other ways to do the domination.) This leaves the two-player game with matrix ( 0 4 ) 1 4 1 3 which can be solved graphically. The highest point on the lower envelope correspond to the intersection from columns 3 and 4 of the original matrix, so we have to solve the 2-by-2 game 3
( ) 4 1. 1 3 This has solution p = (2/5, 3/5), q = (2/5, 3/5), V = 11/5 from the standard formulas for 2-by-2 games. These lift up to the solutions p = (0, 2/5, 3/5, 0)/5, q = (0, 0, 2/5, 3/5)/5 in the larger game. Comments. This problem was pretty straightforward. The principal difficulty was that a few people had bad drawings and solved the 2-by-2 subgame ( ) 0 4 4 1 instead. (This game has value 16/7, which is larger than 11/5.) Not surprisingly there are a few different ways to get through the dominance part of the problem. Grading. 9 for domination. (No matter how you do it there are three domination steps required; I gave 3 for each. You needed to show your work, i. e. say which strategy or combination of strategies dominated each other strategy.) 6 for the graphical solution 3 for knowing what to draw, 3 for identifying the correct intersection. 6 for solving the 2-by-2 game (2 each for p, q, V ). 4 for lifting back to the original 4-by-4 game (2 for each of p and q) Grade distribution: 25: 24. 22-24: 14. 19-21: 5. 16-18: 3. 13-15: 5. 10-12: 6. 7-9: 2. Mean 20.7, median 23, SD 5.4. 4. Player II chooses a number in {1, 2, 3, 4}. Player I attempts to guess the number. If Player I is correct, he wins 1. If the guess of Player I is off by 1 in either direction, he loses 1. Otherwise there is no payoff. Set up the payoff matrix of this game and solve. Solution. The payoff matrix is 1 1 0 0 1 1 1 0 0 1 1 1. 0 0 1 1 At this point there are three different solution paths, which all (of course!) give the same answer. Solution A. Observe that player 1 s strategy satisfies the system of equations p 1 p 2 = V, p 1 + p 2 p 3 = V, p 2 + p 3 p 4 = V, p 3 + p 4 = V, p 1 + p 2 + p 3 + p 4 = 1. 4
Then solve the system, by whatever means necessary. In the solutions I wrote before the exam, my method was to note that if we interchange p 1 and p 4, and interchange p 2 and p 3, then the system is unchanged. So we must have p 1 = p 4 and p 2 = p 3, giving the system p 1 p 2 = V, p 1 = V, 2p 1 + 2p 2 = 1. Subtracting the second of these from the first gives p 2 = 2V, from which p 2 = 2p 1 ; then the third gives p 1 = 1/6, and so p 2 = 1/3, V = 1/6. This lifts to the solution p = (1/6, 1/3, 1/3, 1/6) with V = 1/6. The strategy for q is the same by symmetry. Solution B. The game is invariant under switching the pairs (1, 4) and (2, 3). Using this we can reduce to the 2-by-2 game ( ) 1/2 1/2. 1/2 0 where the first column and first row correspond to the strategy pick 1 or 4 with equal probability, and the second column and second row to the strategy pick 2 or 3 with equal probability. The solution to the 2-by-2 game is p = q = (1/3, 2/3), V = 1/6 and this lifts to p = q = (1/6, 1/3, 1/3, 1/6) in the 4-by-4 game. Solution C. Invert the matrix! (I won t write out the details.) Of course you get the same answer. Commments. I intended solution A when I wrote the problem, but I m proud of those of you who saw the invariance and came up with solution B. The only error I saw a lot of was claiming that the game is symmetric and therefore the value is zero; this is only true for symmetric games in a certain formal sense. That sense is that A = A T, i. e. the payoff matrix is skew-symmetric. For payoff matrices which are symmetric (A = A T ) the two players have the same optimal strategies but the value is not zero. Grading. 8 points for writing down the matrix. After that: Solution A: 4 for writing down the system of equations, 10 for solving it to get V and p, 3 for observing that by symmetry p = q. I gave 6 (out of 10) for those who solved the system magically and just wrote down p 1 = V, p 2 = 2V, p 3 = 2V, p 4 = V. (Is there some rule I m not aware of for doing this? If so let me know.) Solution B: 4 for finding the invariant strategies. 4 for reducing to the 2-by-2 matrix. 6 for solving the 2-by-2 game (2 for each of V, p, q. 3 for lifting back to the 4-by-4 game. Solution C: 5 for finding A 1. (2 if you just gave the inverse without showing me how you got it; finding the inverse of a 4-by-4 matrix is hardly basic arithmetic. A few brave souls actually inverted the matrix by hand.) 4 for each of V, p, q from the usual formulas. Grade distribution: 25: 21. 22-24: 12. 19-21: 10. 16-18: 1. 13-15: 6. 10-12: 4. 7-9: 3. 4-6: 2. Mean 20.2, median 23, SD 5.8. Some summary comments. I was generally happy with the exam results. I was a bit disappointed with the results for Problem 1, and I m sorry I put it first I didn t realize it was as difficult as it turned out to be! Unsurprisingly, given the background of students in this class, performance was better on problems 3 and 4 than on problems 1 and 2. A good number of people seem to have lost some points for not showing their work; try to be better 5
about this on the final! (On the final I hope time will be less of an issue; you ll have three hours, but I don t expect it will be three times as long as the midterm.) Overall grade distribution was as follows: 90-94: 3. 85-89: 8. 80-84: 11. 75-79: 8. 70-74: 6. 65-69: 7. 60-64: 4. 55-59: 5. 50-54: 1. 45-49: 3. 40-44: 1. 35-39: 2. median 75, mean 72, SD 14. In terms of letter grades, I roughly think of 85 or above as A; 80-84 A-; 75-79 B+; 70-74 B; 65-69 B-; 60-64 B- or C+; 55-59 C+; 50-54 C; 45-49 C-; below 45 as below C-. Note that at the end of the semester your grades will be determined from your numerical scores on exams and homeworks, not from any letter-grade information that I might give out as guidance. If you have an issue with how your exam was graded: If I made an arithmetic mistake in adding up scores: I ll correct these on the spot. For more substantial mistakes: Please put in writing what you feel was done incorrectly. Give this to me, with the original exam, by Friday, October 29. I reserve the right to regrade the entire exam, so it s possible your grade will go up or down. You should know that the rubrics given here are just approximations to what I did (because some of you found ways to solve problems, right or wrong, that didn t necessarily line up with the rubric); I also made an effort to ensure that people who got the same score on a problem really did have comparably good solutions. 6