NIM WITH A MODULAR MULLER TWIST. Hillevi Gavel Department of Mathematics and Physics, Mälardalen University, Västerås, Sweden

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

On Variations of Nim and Chomp

Subtraction games with expandable subtraction sets

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

PRIMES STEP Plays Games

ON SPLITTING UP PILES OF STONES

On Variants of Nim and Chomp

Obliged Sums of Games

On Modular Extensions to Nim

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

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

The strange algebra of combinatorial games

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

Crossing Game Strategies

arxiv: v2 [cs.cc] 18 Mar 2013

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

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

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

A Winning Strategy for the Game of Antonim

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

New Values for Top Entails

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

Analyzing ELLIE - the Story of a Combinatorial Game

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

Games, Triangulations, Theory

A Combinatorial Game Mathematical Strategy Planning Procedure for a Class of Chess Endgames

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

Ultimately bipartite subtraction games

Partizan Kayles and Misère Invertibility

SOLUTIONS FOR PROBLEM SET 4

Another Form of Matrix Nim

Received: 10/24/14, Revised: 12/8/14, Accepted: 4/11/15, Published: 5/8/15

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

Senior Math Circles February 10, 2010 Game Theory II

SOLITAIRE CLOBBER AS AN OPTIMIZATION PROBLEM ON WORDS

SOME MORE DECREASE AND CONQUER ALGORITHMS

Tilings with T and Skew Tetrominoes

On Drawn K-In-A-Row Games

VARIATIONS ON NARROW DOTS-AND-BOXES AND DOTS-AND-TRIANGLES

NIM Games: Handout 1

Eric Duchêne (Univ. Claude Bernard Lyon 1) Michel Rigo (University of Liège)

New Toads and Frogs Results

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

CS 491 CAP Intro to Combinatorial Games. Jingbo Shang University of Illinois at Urbana-Champaign Nov 4, 2016

A variation on the game SET

COMBINATORIAL GAMES: MODULAR N-QUEEN

Analysis of Don't Break the Ice

Number Bases. Ideally this should lead to discussions on polynomials see Polynomials Question Sheet.

Math 127: Equivalence Relations

Programming Problems 14 th Annual Computer Science Programming Contest

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

Narrow misère Dots-and-Boxes

Some Chip Transfer Games Thomas S. Ferguson University of California, Los Angeles

Open Problems at the 2002 Dagstuhl Seminar on Algorithmic Combinatorial Game Theory

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

Peeking at partizan misère quotients

THE CHINESE REMAINDER CLOCK TUTORIAL

THE GAME CREATION OPERATOR

Gale s Vingt-et-en. Ng P.T. 1 and Tay T.S. 2. Department of Mathematics, National University of Singapore 2, Science Drive 2, Singapore (117543)

Three-player impartial games

SMT 2014 Advanced Topics Test Solutions February 15, 2014

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

Math 255 Spring 2017 Solving x 2 a (mod n)

Modular Arithmetic. Kieran Cooney - February 18, 2016

Contest 1. October 20, 2009

Solutions for the Practice Questions

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

Final Exam, Math 6105

The Hex game and its mathematical side

Introduction to Fractions

IMOK Maclaurin Paper 2014

Surreal Numbers and Games. February 2010

Solving Triangular Peg Solitaire

2-PILE NIM WITH A RESTRICTED NUMBER OF MOVE-SIZE IMITATIONS

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

1 In the Beginning the Numbers

Math 152: Applicable Mathematics and Computing

QUIZ: Fill in the blank. Necessity is the Mother of.

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.

The Game of SET R, and its Mathematics.

Sequences. like 1, 2, 3, 4 while you are doing a dance or movement? Have you ever group things into

6.2 Modular Arithmetic

Game 0: One Pile, Last Chip Loses

Legend. The Red Goal. The. Blue. Goal

Bishop Domination on a Hexagonal Chess Board

arxiv: v1 [cs.cc] 12 Dec 2017

1.6 Congruence Modulo m

Number Theory - Divisibility Number Theory - Congruences. Number Theory. June 23, Number Theory

TOPOLOGY, LIMITS OF COMPLEX NUMBERS. Contents 1. Topology and limits of complex numbers 1

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

Mathematical Investigation of Games of "Take-Away"

Introduction. and Z r1 Z rn. This lecture aims to provide techniques. CRT during the decription process in RSA is explained.

arxiv: v1 [math.co] 3 Jun 2015

Principle of Inclusion-Exclusion Notes

o o o o o o o o o o o o

One-Dimensional Peg Solitaire, and Duotaire

What is counting? (how many ways of doing things) how many possible ways to choose 4 people from 10?

Table of Contents. Table of Contents 1

Non-overlapping permutation patterns

12. 6 jokes are minimal.

Transcription:

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 NIM WITH A MODULAR MULLER TWIST Hillevi Gavel Department of Mathematics and Physics, Mälardalen University, Västerås, Sweden hillevi.gavel@mdh.se Pontus Strimling Department of Mathematics and Physics, Mälardalen University, Västerås, Sweden pontus.strimling@mdh.se Received: 11/20/03, Revised: 8/11/04, Accepted: 9/24/04, Published: 9/28/04 Abstract We study Nim with the additional rule that each player can put a constraint on the next player s move. This is called a Muller twist. The constraints are of the form the number taken must not be equivalent to some numbers modulo n. A solution for a large group of such games is given. 1 Introduction An interesting twist on a combinatorial game can be obtained if one allows the players to put constraints on each other s moves. This is called introducing a Muller Twist, after Blaise Muller who invented the game Quarto r, a game where each player chooses the piece the next player should place. This game and several others are described in an article [1] by F. Smith and P. Stănică. A move in a game with a Muller twist consists of a physical move and a choice of a restriction. A position consists of a physical position and a restriction. Imagine a chess game where the other player determines which kind of piece you are allowed to move or points out a square that you must not move to, or a bridge game where your opponent determines which suite you should play. These would all be Muller twist games. Adding a Muller twist to a single game may obviously make it more entertaining to play. It may also make the mathematical analysis of the game more challenging. In this article we will study the game of Nim with restrictions on the number of sticks that can be taken, aiming to solve as large a group of such games as possible.

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 2 2 The game Nim and twists thereupon Nim is an important and well understood combinatorial game, see [2] and [3]. It is commonly played with sticks divided into piles. In each move a player may pick as many sticks as he wants to, but only from one pile. The two players take turns and when a player cannot make a move (because there are no sticks left) he loses. It can be shown [2, 3] that a position is a winning position for the player leaving it (a P-position) if the Nimsum of the pile sizes is 0; otherwise, the position is a winning position for the person receiving it (an N -position). The Nimsum of a set of numbers is computed by bitwise Xor on the binary representation of the numbers, that is, addition modulo 2 without carry. So 9 3=(2 3 +2 0 ) (2 1 +2 0 )=2 3 +2 1 +(2 } 0 {{ 2 } 0 )=10 0 The key observation is (see [3]) the following lemma, which we present without proof: Lemma 1 If a set of numbers have Nimsum 0 and you change one of them, then the new set of numbers will have a Nimsum differing from 0. If a set of numbers have Nimsum differing from 0, then there is a way to decrease at least one of the numbers so that the new Nimsum is 0. 2.1 Odd-or-even-Nim Odd-or-even-Nim is analyzed in F. Smith and P. Stănică s article [1]. In this twisted form, the previous player tells the next player if she should take an odd or an even number of sticks. Smith and Stănică show that the P-positions are the positions satisfying one of three properties: Nimsum 0, restriction even Nimsum 1, restriction even Nimsum 0, all piles are even and restriction odd. The proof is elegant, but provides no intuition for why the results look like they do. In order to gain better understanding, we looked closer at the game structure and generalized the Muller twist. Odd or even tells if a number is equivalent to 1 or to 2 modulo 2. A related twist is to play modulo 3 instead. Then there are three classes of numbers, equivalent to 1,

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 3 (4, 2, 1) 1 (2, 2, 1)? (1, 2, 1)? (4, 1)? (2, 2, 1) 1 (4, 2, 1) 1 (2, 1) 1 (2, 1) 2 (1) 1 (1, 1) 1 Figure 1: A player is passed three piles containing 4, 2 and 1 sticks together with the restriction the number taken must not be equivalent to 1 modulo 3. That means that taking 1 or 4 sticks is forbidden, so the player has to take 2 or 3 sticks from one of the piles. There are three ways to do this. If the player chooses to take 2 from the largest pile, and hands over the position with the restriction not 1, the other player has to take all the sticks in one of the two 2-stick piles. Then, there are two sensible constraints that can be put. (Forbidding 3, which is not possible anyway, seems pointless.) Both constraints make it possible for the first player to reduce the game to a set of one-stick piles, and setting the restriction not 1 makes this a terminal position, a losing position for the other player. Thus, (4, 2, 1) with the restriction not 1 is a winning position for the player being handed that position; an N -position. Furthermore, going to (2, 2, 1) and setting the restriction not 1 is the only way to win. One can check this by investigating the other options in the same way as used with this one. 2 or 3, and the player can disallow one of them. So the player leaving the position says the number of sticks taken must not be equivalent to x modulo 3. An example of a game of this form is given in Figure 1. We will study several variations of this game, varying the modulo used and the number of forbidden moves. We will solve those games where all combinations of up to a given number of options are allowed as restrictions, and also some games where not all combinations may be used. 2.2 Modular one-blocking Nim In our first generalized version of odd-or-even-nim, which we will call modular oneblocking Nim, the restriction is of the form the number of sticks taken must not be equivalent to x modulo n. Our analysis of this game turned up a surprise: The modulo used actually does not matter! The only important thing is whether the restriction allows you to take exactly one stick or not. Theorem 1 In modular one-blocking Nim the P-positions are characterized by having either of two properties:

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 4 1. Positions where the Nimsum of the quotients of the pile sizes divided by 2 is 0, and where the restriction is the number of sticks taken must not be equivalent to 1 modulo n. 2. Positions where the Nimsum of the quotients is 0 and where all the remainders of the pile sizes divided by 2 are 0 (that is, all the pile sizes are even), any restriction. Proof First we must show that if we are given a position of type 1 or 2, then we have to return a position from the complement set (if any move at all is possible): 1. If the Nimsum of the quotients is 0 and the restriction is not 1, then we have to take at least two sticks. Taking two or more sticks from a pile changes the quotient, which means that the Nimsum of the quotients will change too (Lemma 1), so we will hand over a position where the Nimsum is not 0. 2. If the Nimsum is 0 and all the remainders are 0 too, then we have to change a quotient when we take some sticks, even if we take just one and thus cause the Nimsum to change. Second, we must show that if we are given a position from the complement set, then it is always possible to make a move and return a position of type 1 or 2: 1. If the Nimsum of the quotients is not 0, then there is at least one way to change the quotients to make it so. There are two different ways to give the chosen pile the desired quotient one where the remainder is 0 and one where it is 1. The restriction is only able to block one of these alternatives. We will certainly be able to hand over a position of type 1. If none of the remainders are 1, we can hand over type 2 instead. 2. If the Nimsum is 0, at least one remainder is 1 and we are allowed to take just one stick, then we can take this remainder and keep the Nimsum 0. We can either hand over a position of type 1 or 2 (the latter if just one of the remainders in the original position was 1). If we look at the game in Figure 1, we find that the position (4, 2, 1) 1 has the quotients (2, 1, 0). The Nimsum of the quotients is 2 1 0=3 0, so this position is indeed an N -position. When the player moves to (2, 2, 1) 1 the quotients are changed to (1, 1, 0), and 1 1 0 = 0. The remainders are (0, 0, 1), so the player has to block 1 to make this a P-position. The given move is the only way for the first player to win the game, as stated. The P-positions in modular one-blocking Nim are the same as in odd-or-even-nim (if we regard not 1 as the same thing as even and everything else as odd ). An

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 5 0 P P N N N N N 1 P P N N N N N 2 N N P P N N N 3 N N P P N N N 4 N N N N P P N 5 N N N N P P N (a) Constraint not 1. (In odd-or-even-nim: constraint even.) 0 P N N N N N N 1 N N N N N N N 2 N N P N N N N 3 N N N N N N N 4 N N N N P N N 5 N N N N N N N (b) Constraint anything except not 1. (In oddor-even-nim: constraint odd.) Figure 2: N - and P-positions when playing modular one-blocking Nim with two piles. On the matrix we have superimposed a grid. Positions within the same box of the grid have the same quotients when divided by 2. The remainders give the position within the box. In (b) we can note that the P-positions are the ones where both numbers are even, that is, where both remainders are 0. illustration is given in Figure 2. The equivalence of the two sets follows from the following observations: The quotient when dividing a number by 2 is what you get if you cut out the least significant bit, while the remainder is that bit. If the Nimsum of the quotients is 0, then the Nimsum of the original numbers will have 0s in all positions except the least significant one, that may be 0 or 1. That is, the Nimsum of the original numbers will be 1 or 0.The P-positions of odd-or-even-nim were described as Nimsum 0, restriction even Nimsum 1, restriction even Nimsum 0, all numbers even, restriction odd The first two kinds are the same as type 1, and the last one is type 2. (If all the numbers are even, the least significant bits will be 0, so if the Nimsum of the quotients is 0, so is the Nimsum of the original numbers.) 3 Further generalization Even further generalizations of odd-or-even-nim can be made. In the previous section, we blocked one modular option. We will now consider a game where a greater number

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 6 of options can be blocked. As a start, we will express Theorem 1 in a more general way: Theorem 1 (rephrased) In modular one-blocking Nim the P-positions are the positions where the Nimsum of the quotients of the pile sizes divided by 2 is 0 and where all the remainders are smaller than the smallest amount that can be taken according to the constraint. The reason that the theorem involves division by two is that we can force the adversary to take at least two sticks, but not more. If we block 1, taking 2 is an option. If we block 2, taking just one is possible. We can call 2 the smallest unavoidable number. 3.1 Blocking a fixed number of options Our next generalized set of games will be called k-blocking modular Nim. Here, a constraint consists of exactly k different subconstraints of the kind you must not take a number equivalent to x modulo n. All the ( n k) possible combinations of subconstraints may be used. So in 4-blocking modular Nim with modulo 10, one possible restriction is you can not take a number equivalent to 1, 3, 6 or 8 modulo 10. Lemma 2 If the constraint consists of k subconstraints, then you can force the adversary to take at least k + 1 sticks. (That is when the set of subconstraints is not 1, not 2,..., not k.) We will call this the strictest constraint. Theorem 2 In k-blocking modular Nim the P-positions are the positions where the Nimsum of the quotients of the pile sizes when divided by k + 1 is 0 and all remainders are smaller than the smallest number of sticks that can be taken according to the given constraint. Proof Starting with the P-positions: If all the remainders are smaller than the smallest number of sticks that can be taken, then the move will change one of the quotients, so the Nimsum of the quotients will not be 0 (Lemma 1). Continuing with the N -positions:

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 7 0 P P P N N N N 1 P P P N N N N 2 P P P N N N N 3 N N N P P P N 4 N N N P P P N 5 N N N P P P N (a) The strictest constraint: not 1 and not 2. 0 P P N N N N N 1 P P N N N N N 2 N N N N N N N 3 N N N P P N N 4 N N N P P N N 5 N N N N N N N (b) Not 1, not 3 and not 1, not 4. (That is, constraints blocking 1 but not 2.) 0 P N N N N N N 1 N N N N N N N 2 N N N N N N N 3 N N N P N N N 4 N N N N N N N 5 N N N N N N N (c) Constraints not 2, not 3, not 2, not 4 and not 3, not 4. (That is, constraints not blocking 1.) Figure 3: Playing 2-blocking Nim modulo 4, and using two piles. 2-blocking means that it is the quotient and remainder when dividing by three that is important. When using just two piles, the Nimsum equals 0 if and only if the piles are equal, which means that the P-positions will be placed along the main diagonal. If the Nimsum of the quotients is not 0, then one can make it 0 by changing one of the quotients (Lemma 1). There are k + 1 different pile sizes that have the desired quotient, and the constraint is only able to block k of them. Having made the Nimsum 0, we can choose a constraint that is bigger than all the remainders. (If we choose the strictest constraint, the one that forces the adversary to take at least k + 1 sticks, all the remainders will be smaller than that, as they can not exceed k.) If the Nimsum of the quotients is 0, but at least one of the remainders is at least as big as the smallest number of sticks we may take, then we can decrease that remainder keeping the quotient constant. The Nimsum will still be 0, and we can choose a constraint strict enough to leave a P-position. (Note: This situation only occurs after suboptimal play, as the player giving the constraint could have chosen a stricter one, making the position a P-position instead.) An illustration of N - and P-positions in a game is given in Figure 3. Corollary 1 (push-them-upwards) It is never an advantage to give any other constraint than the strictest one, and sometimes it is a disadvantage. 3.2 Blocking a variable number of options A further generalizations of the game allows blocking of any number of options, up to a certain limit k. This does not change the analysis, since it is never disadvantageous to

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 8 0 P N N P N N P 1 N N N N N N N 2 N N P N N P N 3 P N N P N N P 4 N N N N N N N 5 N N P N N P N 6 P N N P N N P (a) Constraint not 2, not 3 (that is: the number taken must be equal to 1 modulo 3). 0 P P N N P N N 1 P P N N P N N 2 N N P N N P N 3 N N N P N N P 4 P P N N P N N 5 N N P N N P N 6 N N N P N N P (b) Constraint not 1, not 3 (the number taken must be equal to 2 modulo 3). Figure 4: Playing blocking Nim modulo 3, each constraint blocking two options, but the strictest combination not 1, not 2 disallowed. The pattern is completely different from when the strictest combination is allowed. If not 1, not 2 is an option, then we get the same pattern as in Figure 3. use the maximum number k of blockings. 3.3 Blocking certain combinations of options We propose as an open problem to find the solution of the general modular blocking Nim game, that is, when the set of allowed restrictions is any subset of the set of all possible combinations of subrestrictions. The following observations tell how far we have come with this problem: Observation 1 The characterization of P-positions in Theorem 2 holds even if we do not allow all combinations of at most k subconstraints, as long as the strictest constraint, that is, the combination not 1, not 2,..., not k is an option. The same proof goes through. The important thing is that we are able to use the strictest constraint, and thus force the adversary to change a quotient. Observation 2 The characterization of P-positions in Theorem 2 does not hold if we do not include the strictest constraint not 1, not 2,..., not k as an option. The parts the constraint is only able to block k of them and If we choose the strictest constraint of the proof will not work anymore. If the grid size is determined by the number of constraints, so that we divide by k +1, then we are not always able to force the adversary to change a quotient, since we need the strictest constraint to ensure that.

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 4 (2004), #G04 9 If the grid size is determined by the lowest unavoidable number (less than k + 1) the k subconstraints may be able to block every way to get the desired quotient. Figure 4 shows an example of a game where the strictest constraint is excluded. 4 Conclusion There are surprisingly few Muller twist games solved. Some, besides Odd-or-even-Nim, are described in [1], some others in [4]. We hope that we have given inspiration for further works in this field. We thank an anonymous referee and Kimmo Eriksson for many useful comments. References [1] F. Smith, P. Stănică, Comply/Constrain Games or Games with a Muller Twist, Integers 2, art. G3, 2002. [2] E.R. Berlekamp, J.H. Conway, R.K. Guy, Winning Ways, A K Peters, Ltd., 2001. [3] J.H. Conway, On Numbers and Games, AKPeters, Ltd., 2001. [4] A. Flammenkamp, A. Holshouser, H. Reiter, Dynamic One-Pile Blocking Nim, Electron. J. Combin., Volume 10(1), art. N4, 2003.