Senior Math Circles February 10, 2010 Game Theory II

Similar documents
Jim and Nim. Japheth Wood New York Math Circle. August 6, 2011

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves.

Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games

STAJSIC, DAVORIN, M.A. Combinatorial Game Theory (2010) Directed by Dr. Clifford Smyth. pp.40

Grade 7/8 Math Circles Game Theory October 27/28, 2015

Grade 6 Math Circles Combinatorial Games - Solutions November 3/4, 2015

Three Pile Nim with Move Blocking. Arthur Holshouser. Harold Reiter.

Tangent: Boromean Rings. The Beer Can Game. Plan. A Take-Away Game. Mathematical Games I. Introduction to Impartial Combinatorial Games

Plan. Related courses. A Take-Away Game. Mathematical Games , (21-801) - Mathematical Games Look for it in Spring 11

A Winning Strategy for the Game of Antonim

Grade 7 & 8 Math Circles. Mathematical Games

OCTAGON 5 IN 1 GAME SET

Subtraction games with expandable subtraction sets

GAME THEORY. Thomas S. Ferguson

Solutions to Part I of Game Theory

NIM Games: Handout 1

Grade 6 Math Circles Combinatorial Games November 3/4, 2015

Final Exam, Math 6105

1, 2,, 10. Example game. Pieces and Board: This game is played on a 1 by 10 board. The initial position is an empty board.

SOME MORE DECREASE AND CONQUER ALGORITHMS

DELUXE 3 IN 1 GAME SET

Definition 1 (Game). For us, a game will be any series of alternating moves between two players where one player must win.

Figure 1: A Checker-Stacks Position

Week 1. 1 What Is Combinatorics?

Game 0: One Pile, Last Chip Loses

Obliged Sums of Games

Background. Game Theory and Nim. The Game of Nim. Game is Finite 1/27/2011

Crossing Game Strategies

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

GEOGRAPHY PLAYED ON AN N-CYCLE TIMES A 4-CYCLE

(b) In the position given in the figure below, find a winning move, if any. (b) In the position given in Figure 4.2, find a winning move, if any.

Notes for Recitation 3

Some Unusual Applications of Math

Games, Triangulations, Theory

Some forbidden rectangular chessboards with an (a, b)-knight s move

Problem F. Chessboard Coloring

Wythoff s Game. Kimberly Hirschfeld-Cotton Oshkosh, Nebraska

GAMES AND STRATEGY BEGINNERS 12/03/2017

N-Queens Problem. Latin Squares Duncan Prince, Tamara Gomez February

EXPLORING TIC-TAC-TOE VARIANTS

Game, Set, and Match Carl W. Lee September 2016

Second Annual University of Oregon Programming Contest, 1998

PRIMES STEP Plays Games

Game Theory and an Exploration of 3 x n Chomp! Boards. Senior Mathematics Project. Emily Bergman

Sept. 26, 2012

Canadian Mathematics Competition An activity of The Centre for Education in Mathematics and Computing, University of Waterloo, Waterloo, Ontario

Game, Set, and Match Carl W. Lee September 2016

Ivan Guo. Broken bridges There are thirteen bridges connecting the banks of River Pluvia and its six piers, as shown in the diagram below:

YourTurnMyTurn.com: chess rules. Jan Willem Schoonhoven Copyright 2018 YourTurnMyTurn.com

Contents. MA 327/ECO 327 Introduction to Game Theory Fall 2017 Notes. 1 Wednesday, August Friday, August Monday, August 28 6

Chess Handbook: Course One

arxiv: v1 [cs.dm] 13 Feb 2015

Figure 1: The Game of Fifteen

arxiv: v1 [math.co] 24 Nov 2018

Chapters 1-3, 5, Inductive and Deductive Reasoning, Fundamental Counting Principle

7. Suppose that at each turn a player may select one pile and remove c chips if c =1

Math Contest Preparation II

On Variations of Nim and Chomp

Odd king tours on even chessboards

Sequential games. We may play the dating game as a sequential game. In this case, one player, say Connie, makes a choice before the other.

Which Rectangular Chessboards Have a Bishop s Tour?

Analyzing Games: Solutions

Formidable Fourteen Puzzle = 6. Boxing Match Example. Part II - Sums of Games. Sums of Games. Example Contd. Mathematical Games II Sums of Games

Another Form of Matrix Nim

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

Impartial Combinatorial Games Berkeley Math Circle Intermediate II Ted Alper Evans Hall, room 740 Sept 1, 2015

Monday, February 2, Is assigned today. Answers due by noon on Monday, February 9, 2015.

4th Pui Ching Invitational Mathematics Competition. Final Event (Secondary 1)

Pennies vs Paperclips

Stat 155: solutions to midterm exam

Combined Games. Block, Alexander Huang, Boao. icamp Summer Research Program University of California, Irvine Irvine, CA

MATHEMATICS ON THE CHESSBOARD

Mathematics. Programming

Wordy Problems for MathyTeachers

Tilings with T and Skew Tetrominoes

Wednesday, February 1, 2017

CS103 Handout 25 Spring 2017 May 5, 2017 Problem Set 5

CS 32 Puzzles, Games & Algorithms Fall 2013

Game Simulation and Analysis

The Teachers Circle Mar. 20, 2012 HOW TO GAMBLE IF YOU MUST (I ll bet you $5 that if you give me $10, I ll give you $20.)

Surreal Numbers and Games. February 2010

Nontraditional Positional Games: New methods and boards for playing Tic-Tac-Toe

Lecture 6: Latin Squares and the n-queens Problem

Reflections on the N + k Queens Problem

12. 6 jokes are minimal.

Mathematical Investigation of Games of "Take-Away"

Caltech Harvey Mudd Mathematics Competition February 20, 2010

The Hex game and its mathematical side

Guest Lecture, October

On Variants of Nim and Chomp

The tenure game. The tenure game. Winning strategies for the tenure game. Winning condition for the tenure game

Grades 7 & 8, Math Circles 27/28 February, 1 March, Mathematical Magic

arxiv: v2 [cs.ai] 15 Jul 2016

Triple Challenge.txt

Math 152: Applicable Mathematics and Computing

Weighted Polya Theorem. Solitaire

Combinatorial Games. Jeffrey Kwan. October 2, 2017

Binary Games. Keep this tetrahedron handy, we will use it when we play the game of Nim.

Circular Nim Games. S. Heubach 1 M. Dufour 2. May 7, 2010 Math Colloquium, Cal Poly San Luis Obispo

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game.

Transcription:

1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Senior Math Circles February 10, 2010 Game Theory II Take-Away Games Last Wednesday, you looked at take-away games with two players, A and B. In most of these games, the two players must follow the same rules, and both players have a set of allowed moves. The first player who faces a configuration from which there are no allowed moves loses. The general idea in analyzing such games is to partition the set of all game configurations into winning and losing positions. Let P be the set of all positions/configurations that one could ever reach in a game. Then we will try to find a partition of P into losing positions L and winning positions W; i.e., P = L W and L W =. To have a winning strategy, a player must be able to force the other player into a losing position, in every one of her turns. An idea that is often helpful, is the following pairing trick. [Pairing] Partition the set of all positions P into pairs (p 1, p 2 ), (p 3, p 4 ),..., (p k 1, p k ) such that there is a legal move from p i to p i+1 for all pairs (p i, p i+1 ). Whenever the opponent occupies p i, you will play p i+1. Since the elements of the pairs partition P, your opponent will run out of moves first. Here are some example games for this strategy. [G1] Bachet s Game. We have n checkers, and the legal moves are M = {1, 2,..., k} for some 1 k < n. The winner is the player who takes the last checker. Let n be the number of checkers remaining. The positions m = 1,..., k are winning positions, since the player can remove n checkers. The position n = k + 1 is a losing position, since the player can remove at most k checkers, leaving the next player with a number of checkers between 1 and k, which is a winning position. The positions n = k + 2,..., 2k + 1 are winning positions since the player can remove enough checkers to leave the next player with k + 1 checkers. In general, any position with a multiple k + 1 checkers is a losing position. [G2] A variant of the above game: we have a row of n + 1 cells with a checker in cell n. In each move, a player may move the checker i cells to the left, where i M = {1, 3, 8} The winner is the last player that has a legal move.

2 0 1 2 n-1 n What are the winning and losing positions in this game? n Losing or Winning? 0 L 1 W, move 1 2 L, must move 1 3 W, move 3 4 L, must move 1 or 3 5 W, move 1 6 L, must move 1 or 3 7 W, move 1 8 W, move 8 9 W, move 3 10 W, move 8 11 L, must move 1, 3 or 8 12 W, move 1 Claim: L = {11i + j : i = 0, 1,..., j {0, 2, 4, 6}} Proof: We see that this is true when i = 0. Assume it is true for i = k. Consider positions 11(k + 1),..., 11(k + 1) + 10. 11(k + 1) is a losing position since you can only get to 11k + 10, 11k + 8 or 11k + 3. 11(k + 1) + 1 is a winning position since you can get to 11(k + 1). 11(k + 1) + 2 is a losing position since you can only get to 11(k + 1) + 1, 11k + 10 or 11k + 5. 11(k + 1) + 3 is a winning position since you can get to 11(k + 1) + 2. 11(k + 1) + 4 is a losing position since you can only get to 11(k + 1) + 3, 11(k + 1) + 1 or 11k + 7. 11(k + 1) + 5 is a winning position since you can get to 11(k + 1) + 4. 11(k + 1) + 6 is a losing position since you can only get to 11(k + 1) + 5, 11(k + 1) + 3 or 11k + 9. 11(k + 1) + 7 is a winning position since you can get to 11(k + 1) + 6. 11(k + 1) + 8 is a winning position since you can get to 11(k + 1). 11(k + 1) + 9 is a winning position since you can get to 11(k + 1) + 6. 11(k + 1) + 10 is a winning position since you can get to 11(k + 1) + 2. Therefore if it is true for i = k, it is also true for i = k + 1. By induction, it is true for i = 0, 1,.... [G3] In this game, let us suppose that we have an 8 8 chess board. Players B and W alternately place black and white knights on the board. Each player needs to put her knight in to unoccupied positions that are not threatened by any knight of the other colour. Who wins?

3 The second player has a winning strategy. They mirror the move of the first player by reflecting the knight placement through line M 1 and then line M 2 (three examples of this mirroring are shown on the diagram below). At any point after the second player has taken their turn, the chessboard will be perfectly symmetric. Therefore, if the first player can place a piece in a non-threatened square, the second player will also be able to place a piece in a non-threatened square, and so the first player will always run out of moves first. M 1 M 2 [G4] Double Chess. We will change the rules of Chess as follows. In each turn, any of the two players White and Black can make two instead of the usual one move. White moves first. Can White lose this game? Claim: White can at least force a tie. Proof: Assume Black has a winning strategy. Then White could play the following opening move: knight out and back in. Now the board looks untouched and Black is in the exact same situation that White was in. If Black has a winning strategy, so does White, a contradiction. Therefore Black cannot possibly have a winning strategy. Nim & Nim Sums One of the games you studied in the previous lecture were Nim. We restate it here for completeness. [G5] In the game of Nim, we have k > 0 stacks of chips; initially, stack i has n i chips. Players A and B alternately choose a stack, and remove any positive number of chips from it. The first player who cannot move at her turn loses. We will now present a very elegant analysis of this game via Nim sums. We need some definitions before we start. A basic fact that we will use is that every integer n can be written as the sum of powers of 2 in a unique way; this is called the binary representation of n. Formally, we write n = (n d n d 1... n 0 ) 2 where n i {0, 1} for all i, if n = 2 d n d + 2 d 1 n d 1 +... + 2n 1 + n 0.

4 For example, 21 = (10101) 2 = 2 4 + 2 2 + 2 0. The Nim sum z of k numbers n 1,..., n k is now defined as the sum of their binary representations modulo 2, and we denote it by z = n 1 n 2... n k. Let (n i d... ni 0) 2 be the binary representation of the ith number above, and let (z d z d 1... z 0 ) 2 be that of z. Then z i = n 1 i + n 2 i +... + n k i mod 2, for 1 i d. Let s look at an example. The Nim sum of integers 13, 12, and 8 is given by 13 = (1101) 2 12 = (1100) 2 8 = (1000) 2 = 9 = (1001) 2 Have a look at the ith column on the right-hand side of the system above. The binary representation of the Nim sum has a 0 in the ith position if there are an even number of 1 s in the ith column above the separator line; otherwise the entry is a 1. Let s do some more examples before we continue. [Ex1] What is the Nim sum of 22 and 51? 22 = (10110) 2 51 = (110011) 2 = 37 = (100101) 2 [Ex2] How about that of 4, 12 and 8? 4 = (100) 2 12 = (1100) 2 8 = (1000) 2 = 0 = (0000) 2 What is the connection to Nim? Well, let us consider Nim with three piles; i.e., k = 3. As we have seen this game last time, we know what the winning and losing positions are. We will use (n 1, n 2, n 3 ) for a game position in which pile i has n i chips. When is a position a winning position, and when is it a losing position? Let s do some examples. Clearly, (0, 0, 0) is a losing position, as the current player has no valid move. How about (0, 1, 1), and what happens in (0, 2, 1)? Finally, who is the winner in (0, p + 1, p) for some integer p?

5 [Ex3] Compute the Nim sums for each of the situations in the examples above. Do you see a pattern? 0 0 0 = (0) 2 (0) 2 (0) 2 = 0 0 1 1 = (0) 2 (1) 2 (1) 2 = 0 0 2 1 = (0) 2 (10) 2 (1) 2 = (11) 2 = 3 0 (p + 1) p 0 The following theorem provides a nice analysis of the entire game. Theorem 1 (Bouton, 1902). A Nim position (n 1,..., n k ) is a losing position if and only if n 1... n k = 0. The theorem immediately tells us that the game situation p = (13, 12, 8) is a winning position. But what should a clever player do in this situation? Well, we would like to move to a losing position p if possible. Bouton s theorem above says that it suffices to move to a position p whose Nim sum is 0. [Ex4] Can you think of a winning move in (13, 12, 8)? Is it unique or are there more than one? 13 = (1101) 2 12 = (1100) 2 8 = (1000) 2 = 9 = (1001) 2 Three possible solutions are to remove 9 from the pile of 13, to remove 7 from the pile of 12 or to remove 7 from the pile of 8. All three of these solutions give a Nim-Sum of zero. [Ex5] Is (27, 25, 9) a winning position? If so, what is a winning move from here? 27 = (11011) 2 25 = (11001) 2 9 = (1001) 2 = 11 = (01011) 2 The Nim-Sum is not zero, so it is a winning position. Three possible winning moves are to remove 11 from the pile of 27, to remove 7 from the pile of 25 or to remove 7 from the pile of 9. In fact it turns out that, if p = (n 1,..., n k ) is a position with Nim sum different from 0, then there is always a move p p such that p has Nim sum 0. Claim 1. Let p = (n 1,..., n k ) be a Nim position whose Nim sum is different from 0. Then there is a position p reachable from p with Nim sum 0. The previous claim is the centre piece of the proof of Bouton s theorem.

6 Problem Set [P1] Consider Bachet s game [G1] where the set of legal moves M consists of the powers of 2; i.e., M = {1, 2, 4, 8,...}. Who wins? How about the case where M is the set {1, 2, 3, 5, 7, 11,...} (1 and all primes)? [P2] Wythoff s Game. There are two piles of checkers on the table. Player A takes any number of checkers from one pile, or the same numbers of checkers from each of the two piles. The B does the same. The winner is the one to take the last chip. Positions are pairs [x i, y i ] of non-negative integers where x i y i. (a) Does the first player have a winning strategy starting from [6, 10]? (b) How about from [9, 10]? (c) If you order the losing positions by their first coordinate, you obtain: Do you see a pattern? Can you explain it? [0, 0], [1, 2], [3, 5], [4, 7], [6, 10], [8, 13], [9, 15],... [P3] Players A and B alternately put white and black bishops on the squares of an 8 8 chess board. Each player needs to choose a position that is unoccupied, and unthreatened by an opponent s bishop. The first player who cannot place a bishop loses. Who wins? [P4] This is a one-person game. There are L boxes where box i B = {1,..., L} initially contains precisely i chips. In each move, you may pick an arbitrary subset S of B, and a number j; you then remove j chips from each of the boxes in S. (a) Consider the case where k = 7. How many moves do you need to empty all the boxes? (b) How many moves are needed for k = 2010? [P5] A king is placed at the upper left corner of an m n chess board. Players A and B move the king alternately, but the king may not be moved to a square occupied earlier. The loser is the first player who cannot move. (a) Consider the case where m = n = 3. Who wins? (b) How about m = 3 and n = 4? (c) Can you give a general argument? [P6] (a) What is the Nim sum of 27 and 17? (b) The Nim sum of 38 and x is 25. What is x? [P7] Find all the winning moves in the game of Nim, (a) with three piles of 12, 19, and 27 chips. (b) with four piles of 13, 17, 19, and 23 chips.

7 [P8] Nimble. Nimble is played on a game board consisting of a line of squares labelled 0, 1, 2, 3,... A finite number of coins is placed on the squares with possibly more than one coin on any single square. A move consists of taking one of the coins and moving it to any square on its left, possibly moving it over some other coins, and possibly moving it onto a square that already has a coin. The players alternate, and the game ends when all coins are on square 0. The last player who moves wins. In the following position with 6 coins, who wins, the current player, or the next? If the current player wins, what is her winning move? 0 1 2 3 4 5 6 7 8 9 10 11 12 13 [P9] Even Nim Positions. Suppose that we are playing Nim with an even number k = 2q of piles. You are facing a position p = (p 0,..., p k 1 ) where p 2i = p 2i+1 for all i = 0,..., q 1. Can you win this game? [P10] Turning Turtles. A horizontal line of n coins is laid out randomly, with some coins showing heads, and some tails. A move consists of turning over one of the coins from heads to tails, and in addition, if desired, turning over one other coin to the left of it (from heads to tails, or tails to heads). For example consider the following sequence of n = 13 coins: 1 2 3 4 5 6 7 8 9 10 11 12 13 T H T T H T T T H H T H T One possible move in this position is to turn the coin in position 9 from heads to tails, and also the coin in place 4 from tails to heads. The winner is the last player to move. (a) Show that this game is just Nim in disguise if an H in place n is taken to represent a pile with n chips. Hint: [P8] is useful here! (b) Find a winning move in the above position. [P11] Northcott s Game. Consider the following 2 7 checker board. Each row contains a white and a black checker. There are two players W and B that move alternately. W moves only the white checkers, and B moves only the black checkers. In each move, a player must move one of its checkers. A checker may move any number of squares to the left or right in its row. Checkers are not allowed to jump over opponent s checkers. The first player that cannot move loses. (a) How does this game compare to Nim? (b) Who wins in the situation depicted above?