of Nebraska - Lincoln

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

GAMES AND STRATEGY BEGINNERS 12/03/2017

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

Testing Naval Artillery and Other Things

The Four Numbers Game

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

Take one! Rules: Two players take turns taking away 1 chip at a time from a pile of chips. The player who takes the last chip wins.

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

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

EXPLORING TIC-TAC-TOE VARIANTS

Grade 7 & 8 Math Circles. Mathematical Games

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

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

Wythoff s Game. Kimberly Hirschfeld-Cotton Oshkosh, Nebraska

Surreal Numbers and Games. February 2010

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

Senior Math Circles February 10, 2010 Game Theory II

Game 0: One Pile, Last Chip Loses

Making Middle School Math Come Alive with Games and Activities

Final Exam, Math 6105

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

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

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

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

Contest 1. October 20, 2009

2. Tell your partner to examine the cards, and give you the cards on which the number

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

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.

CHECKMATE! A Brief Introduction to Game Theory. Dan Garcia UC Berkeley. The World. Kasparov

Checkpoint Questions Due Monday, October 7 at 2:15 PM Remaining Questions Due Friday, October 11 at 2:15 PM

SOME MORE DECREASE AND CONQUER ALGORITHMS

Math 152: Applicable Mathematics and Computing

Problem F. Chessboard Coloring

Sept. 26, 2012

Math Circle: Logic Puzzles

Milton Public Schools Elementary Summer Math

of Nebraska - Lincoln

Go to Grade 4 Everyday Mathematics Sample Lesson

Making Middle School Math Come Alive with Games and Activities

of Nebraska - Lincoln

Winslow C of E Combined School. Progression in the 4 Operations & Fun Maths Activities to do at Home.

CPM EDUCATIONAL PROGRAM

On Variations of Nim and Chomp

Analysis of Don't Break the Ice

On Variants of Nim and Chomp

COUNT ON US SECONDARY CHALLENGE STUDENT WORKBOOK GET ENGAGED IN MATHS!

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

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

Probability and Statistics

Pair counting. Maths focus: Counting on in ones, tens or hundreds from any number. What you need: Instructions

PRIMES STEP Plays Games

(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.

Maths is all around us and we re using it every day!

The Human Calculator: (Whole class activity)

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

Year 6. Mathematics A booklet for parents

Solutions to Part I of Game Theory

saying the 5 times, 10 times or 2 times table Time your child doing various tasks, e.g.

NAME DATE. b) Then do the same for Jett s pennies (6 sets of 9 pennies with 4 leftover pennies).

Use the following games to help students practice the following [and many other] grade-level appropriate math skills.

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

Junior Circle Meeting 5 Probability. May 2, ii. In an actual experiment, can one get a different number of heads when flipping a coin 100 times?

100 IDEAS FOR USING A HUNDRED SQUARE

Games of Skill ANSWERS Lesson 1 of 9, work in pairs

HOW TO PLAY Shape Card Games

Pattern and Place Value Connections

NIM Games: Handout 1

Figure 1: The Game of Fifteen

Cross Out Singles. 3. Players then find the sums of the rows, columns, and diagonal, and record them in the respective circles.

A Winning Strategy for the Game of Antonim

Mathematical Magic Tricks

Counters in a Cup In and Out. The student sets up the cup, drops the counters on it, and records how many landed in and out of the cup.

37 Game Theory. Bebe b1 b2 b3. a Abe a a A Two-Person Zero-Sum Game

Subtraction games with expandable subtraction sets

On Modular Extensions to Nim

Games for Drill and Practice

MATHEMATICS UTAH CORE GUIDES GRADE 2

Abstract: The Divisor Game is seemingly simple two-person game; but, like so much of math,

Computation in Positional Systems

LEARNING ABOUT MATH FOR K TO 5. Dorset Public School. April 6, :30 pm 8:00 pm. presented by Kathy Kubota-Zarivnij

Games of Skill Lesson 1 of 9, work in pairs

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

St Thomas of Canterbury Catholic Primary School Where every child is special

U strictly dominates D for player A, and L strictly dominates R for player B. This leaves (U, L) as a Strict Dominant Strategy Equilibrium.

Probability: Part 1 1/28/16

Mathematics Alignment Lesson

Probability with Set Operations. MATH 107: Finite Mathematics University of Louisville. March 17, Complicated Probability, 17th century style

Presentation by Toy Designers: Max Ashley

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

Math Games Ideas. For School or Home Education. by Teresa Evans. Copyright 2005 Teresa Evans. All rights reserved.

High-Impact Games and Meaningful Mathematical Dialog Grades 3-5

4.2.4 What if both events happen?

Acing Math (One Deck At A Time!): A Collection of Math Games. Table of Contents

Whenever possible, ask your child to tell you the time to the nearest 5 minutes. Use a clock with hands as well as a digital watch or clock.

Addition and Subtraction

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

Moneybags. by Will Chavis. Combinatorial Games. Instructor: Dr. Harold Reiter

Math 152: Applicable Mathematics and Computing

Mathematics Behind Game Shows The Best Way to Play

In this chapter, I give you a review of basic math, and I do mean basic. I bet you know a lot

Transcription:

University of Nebraska - Lincoln DigitalCommons@University of Nebraska - Lincoln MAT Exam Expository Papers Math in the Middle Institute Partnership 7-2006 The Game of Nim Dean J. Davis University of Nebraska-Lincoln Follow this and additional works at: http://digitalcommons.unl.edu/mathmidexppap Part of the Science and Mathematics Education Commons Davis, Dean J., "The Game of Nim" (2006). MAT Exam Expository Papers. 9. http://digitalcommons.unl.edu/mathmidexppap/9 This Article is brought to you for free and open access by the Math in the Middle Institute Partnership at DigitalCommons@University of Nebraska - Lincoln. It has been accepted for inclusion in MAT Exam Expository Papers by an authorized administrator of DigitalCommons@University of Nebraska - Lincoln.

The Game of Nim Expository Paper Dean J. Davis In partial fulfillment of the requirements for the Master of Arts in Teaching with a Specialization in the Teaching of Middle Level Mathematics in the Department of Mathematics. David Fowler, Advisor July 2006

Davis MAT Expository Paper - 1 The Game of Nim The game of Nim is possibly one of the most frustrating games I have ever played. Just when I started to feel that I had figured the strategy out, my brother, who is a computer programmer, blew me out of the water. I should have known better than to take on a computer wizard. Many sources claim that Nim possibly originated in China. It was played with pieces of paper, coins or whatever objects they could find. Charles Bouton, a professor at Harvard University, gave Nim its name around 1901. He named it after an archaic English word meaning to steal or to take away. Some people have noticed that if you turn the Nim upside-down and backwards it results in Win. In 1901 Bouton published a proof containing a winning strategy for Nim. His strategy was based on the Binary (Base 2) number system. The system of numbers that we use in the United States is called the Hindu-Arabic system. This system is a base ten system and uses the 10 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Whole numbers in this system have a value equal to the sums of the products of the digits and the place values. The place values in this system are as shown here: Etc.; 10,000; 1000; 100; 10; 1. 10 4 10 3 10 2 10 1 10 0 For instance the numeral 1302 has the value of: Etc.; 10,000; 1000; 100; 10; 1 1 3 0 2 which is 1 times 1000 plus 3 times 100 plus 0 times 10 plus 2 times 1.

Davis MAT Expository Paper - 2 All systems do not use 10 digits. Some systems use fewer than 10 digits, and some use more than 10 digits. Each system uses the same number of digits as the base of the system. The modern binary number system was fully documented in 1705 by Gottfried Lebniz in his article Expliction de l Arithmetique Binaire. In the Binary (Base 2) number system we use the two digits 0 and 1. The values of the places in the base 2 system are (shown as base 10 numbers) Etc.; 128; 64; 32; 16; 8; 4; 2; 1. 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 The first place to the left of the decimal point has a value of 1. To get the next value, we multiply 1 by 2 and get 2. To get the next value, we multiply 2 by 2 and get 4. To get the next value, we multiply 4 by 2 to get 8, etc. Each place has a value twice the value of the place to its right. As an example the base 2 numeral of 10111 has a base 10 value of: Etc.; 128; 64; 32, 16, 8, 4, 2, 1. 1 0 1 1 1 which is 1 times 16 plus 0 times 8 plus 1 times 4 plus 1times 2 plus 1 times 1 that all equals 23 (base 10). Because the native language of a computer was based on the binary system, the creation of a Nim playing computer was only a matter of time. Westinghouse Electrical Corporation built the first Nim playing computer in 1940 and exhibited it at the New York Worlds Fair. In 1951, at the Festival of Britian, a Nim-playing robot, called Nimrod, was exhibited. So the next time someone calls you a nimrod you can thank him or her for comparing you to a computer ran robot.

Davis MAT Expository Paper - 3 The game of Nim is a two-player mathematical game of strategy. Players take turns removing objects from distinct piles. A player must remove at least one object on their turn but may remove any number of objects provided they all come from the same pile. Nim is a game of strategy where the outcome is influenced through the interaction with the environment and other players. The crucial factor that separates this type of game from others is that there is no element of chance involved. Both players have equal and complete knowledge of all elements of the game. There is also no physical skill required. Nim was originally played as a misere game, which means that the player to take the last object loses. Nim can also be played as a normal game which means that the person who removes the last object wins. This is called normal play because most games follow this convention, even though the true game of Nim usually does not. The game of Nim can be played either way and the strategy for winning is just reversed. On to the game. For this paper I am going to discuss the particular game of Nim given to me and the winning strategies. My version of Nim is as follows: Imagine you have 3 piles of beans where the first pile has 3 beans, the second pile has 5 beans, and the third pile has 8 beans. The game of Nim is a 2-person game in which a player removes as many beans on their turn as they want, provided the beans are all from the same pile. The winner is the player who takes the last bean. As was stated above the strategy to winning Nim lies in the binary numbers. Whether you are playing with one pile on any number of piles here are the winning secrets. Before we start with my 3 pile game, let s consider a somewhat easier one pile version. This one pile game does not rely on binary numbers but on multiples on some other fixed number.

Davis MAT Expository Paper - 4 One Pile In a normal game of nim where you have one nim pile, and you are allowed to remove from 1 to 4 objects at a time, you can win if you leave the pile with a multiple of 5 objects after your turn. Thereafter, no matter what your opponent does, you can always restore the number of objects to a multiple of 5 when you take your turn. If you cannot leave the pile with a multiple of 5 objects, then your opponent has the advantage, and only an error by your opponent can put you in a position to win the game. So you always want to leave a multiple that is equal to (the maximum removals plus one) to win a normal game of nim. An example of a normal game of one pile For example, lets start a game with 13 objects and you can remove 1-4 objects on one turn. I would remove 3 objects to leave 10 objects for my opponent. If my opponent took one object then I would take four leaving 5 objects left. If my opponent to two object I would have then took three objects again only leaving 5 objects left. If he took three objects then I would have taken two and if he had taken four objects then I would have removed one. At the end of each of my second move I have left five objects. With this strategy I can now guarantee myself of being able to remove the last object by following the same pattern. Along this same thought process if the game starts with 10 or 15 objects then the player that goes first can not win the game unless his opponent makes a mistake.

Davis MAT Expository Paper - 5 In a misere game you want your opponent to take the last object so think of the game in reverse order, that is instead of taking the last object you want to leave one object at the end of your turn. An example of a misere game of one pile (in reverse) For this example you are allowed to remove one, two, or three objects during one turn. If there were two objects at the beginning of your turn, you d take one and win. If there were three objects at the beginning of your turn, you d take two and win. If there were four objects at the beginning of your turn, you d take three and win. So, if you can get your opponent to leave two, three, or four objects at the end of his turn, you can win easily. Let s say there are five objects at the end of your next-to-last turn. If your opponent takes one, then there are four left and you can win. If your opponent takes two, then there are three left and you can win. If your opponent takes three, then there are two left and you can win. So, no matter what move your opponent makes when he/she sees five objects, you win. If the game starts with 15 objects and you can remove 1, 2, or 3 objects in one turn then this is what the first few turns would look like. I go first and remove 2 objects leaving 13. My opponent removes one object to leave me with 12. I would then remove three objects to leave 9. If opponent removed two objects on his first turn (leaving 11) then I would have removed two objects. If opponent had removed three objects on his first turn (leaving 10) then I would have removed one, again leaving 9. With this same strategy I

Davis MAT Expository Paper - 6 can now get so that I leave 5 on my next move and 1 on my next move after that. So, if you can leave five objects after your turn, you win. By this same reasoning, if you can leave nine objects after your turn, you win, because that allows you to get to five. You can figure out the other critical point. So to win at the misere game of nim you want to leave one plus the multiple that is equal to (the sum of maximum removals plus one). Normal game with more than one heap In a game of nim that involves nim piles where you can take as many objects as you want from any one of the piles during your turn, you need to be able to compute a nim sum, which characterizes the configuration of the game. Here's how to do it: Express the number of objects in each nim pile as a binary number, with the only digits being 0 and 1. Fill out the smaller binary numbers with '0's on the left, if necessary, so that all the numbers have the same number of digits. Sum the binary numbers (in base 10), but do not carry Replace each digit in the sum with the remainder that results when the digit is divided by 2 (same as replacing with a 0 if even and 1 if odd). This yields the nim sum. To win at nim, always make a move, when possible, that leaves a configuration with a nim sum of 0. If you cannot do this, your opponent has the advantage, and you have to depend on his or her committing an error in order to win. o Note that if the configuration you are given has a nim sum not equal to 0, there always is a move that creates a new configuration with a nim sum of 0. However, there are usually also moves that will yield configurations that give nim sums not equal to 0, and you need to avoid making these. o Also note that if you are given a configuration that has a nim sum of 0, there is no move that will create a configuration that also has a nim sum of 0. You lose! Example of Computing a Nim Sum Let's say you have three nim piles, with 3, 7, and 11 matchsticks, respectively. As binary numbers, these quantities are 11, 111, and 1011, respectively. Filling out with '0's yields 0011, 0111, and 1011. Summing (in base 10) without carrying, we get:

Davis MAT Expository Paper - 7 0011 +0111 +1011 ---- 1133 Taking the remainders after dividing each digit by 2 yields 1111, which is not equal to 0. Therefore, this configuration is a winning position for the person who is about to take a turn. It follows that you should try not to create this configuration when you take your turn. Now, you need to plan a move that creates a configuration with a nim sum of 0. How about removing 7 matchsticks from the pile that now has 11, leaving 4? We then have: 0011 +0111 +0100 ---- 0222 Taking the remainders after dividing by 2 gives us 0000. This shows that there are no leftovers in any column. This is a configuration that we want to leave for our opponent. Whatever move your opponent makes must change exactly one of the binary numbers. So in one of the rows at least one 1 or zero will be changed, thus creating a non-zero Nim sum. If it is your turn with this configuration, then you can only win if your opponent commits an error. So, let us now try this on the normal game given to us where we have piles of 8 beans, 5 beans, and 3 beans. We have three nim piles, with 8, 5, and 3 beans, respectively. As binary numbers, these quantities are 1000, 101, and 11, respectively. Filling out with '0's yields 1000, 0101, and 0011. Summing with carrying, we get: 1000 +0101 +0011 ---- 1112

Davis MAT Expository Paper - 8 Taking the remainders after dividing each digit by 2 yields 1110, which is not equal to 0. Therefore, this configuration is a winning position for the person who is about to take a turn. It follows that you should try not to create this configuration when you take your turn. Now, you need to plan a move that creates a configuration with a nim sum of 0. How about removing 2 beans from the pile that now has 8, leaving 6? We then have: 0110 +0101 +0011 ---- 0222 Taking the remainders after dividing by 2 gives us 0000. This is a configuration that we want to leave for our opponent. Try the Nim Sum Calculator Applet. You will need to have a Java 2 plug-in to do this. If the nim-sum is even to start the game, this is known as a zero game for there is no way, short of an error by your opponent that you can win. If your opponent plays perfectly there are no options for you. If you see this situation at the beginning of the game, offer to let your opponent go first. Of course if he/she also knows the strategy they will probably refuse. There are many different variations to the game of nim. All you must do is change the number of objects in each pile or change the number of piles. The strategy stays the same. Plainim is the most challenging variation of nim that deviates the first step of finding binary representations. Plainim is played on a 5 by 5 checkerboard by removing and/or adding objects. You therefore have 5 piles of 0, 1, 2, 3, 4, or 5 objects depending on the game being played. The simple rules are: *On a single move, you may only remove/add objects in a single row. *Only one or zero objects are allowed per square.

Davis MAT Expository Paper - 9 *You may only add chips to the right of a chip being removed on the same move. *The one to remove the last chip wins. So you are not only playing the takeaway game but now you can also add objects to a certain pile to get you nim-sum. It sounds so easy doesn t it? But even when you know the strategy and have the game figured out your opponent can add an object to the board and force a whole different game at you. Fibonacci nim is another variation with just one pile but different takeaway rules. In Fibonacci nim the rules are: There is one pile of counters. The first player may remove any positive number of counters, but not the whole pile. Thereafter, each player may remove at most twice the number of counters his opponent took on the previous move. The player who removes the last counter wins. You move first: you can win from the initial position, but don't make any mistakes! The mathematical strategy to winning Fibonacci nim is very complicated and has to do something with Grundy numbers and what you can do with them. In short you need to take the number of counters you have and rewrite it as a sum of smaller Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc.). You will then remove the number of counters equal to the smallest Fibonacci number within this sum expression. As an example let s play a normal game with 26 objects. On my first move I will rewrite 26 as 13 + 8 + 5 and then remove 5 objects leaving 21. If my opponent removes, say 4 objects, which leaves 17. I can write 17 as 13 + 3 + 1 and therefore remove one object to leave 16. With this strategy you have a great chance of winning. You must be careful as you

Davis MAT Expository Paper - 10 reach the lower numbers and remember that you opponent has the option of removing 2x s what you last removed so make sure that your sum expression is with the smallest Fibonacci numbers. If you start a game and do not start with a Fibonacci number then the person that starts has the advantage. If you start a game with a Fibonacci number of objects and your opponent knows the strategy, then she/he will win unless you can convince she/he to go first. Other variations limit you on the number of objects you may remove from a pile. Still another variation, called Wolf nim, allows you to remove multiple objects from different rows. Wolf nim is usually played as a misere game in which the last to remove an object loses. The game of Nim, and all its variations, can be made simple enough for upper elementary students to be successful at or make extremely difficult to challenge the most experienced Mathematician. They are fun, frustrating, and frighteningly habit forming. That has a nim-sum of one, so I win, game over.

Davis MAT Expository Paper - 11 Bibliography Wikipedia, the free encyclopedia, Nim, Retrieved on June 15, 2006 from http://en.wikipedia.org/wiki/nim Colorado State University (Sept. 1996), Binary numbers, Retrieved on July 6, 2006 from http://13d.cs.colorado.edu/courses/csci1200-96/binary.html Dartcy Productions, The nim history, Retrieved on July 6, 2006 from www.dartcy.com/nim.htm Wikipedia, the free encyclopedia, Binary numeral system, Retrieved on July 17, 2006 from http://en.wikipedia.org/wiki/binary_number Bogomoly, A, The game of nim, Retrieved on July 6, 2006 from http://www.cut-the-knot.org/nim_st.shtml Saxton, J. (1983), Algebra ½, Grassdale Publishers, Inc., Lesson 93