12.07.2015 Views

Game Theory Basics - Department of Mathematics

Game Theory Basics - Department of Mathematics

Game Theory Basics - Department of Mathematics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1.10. SUMS OF NIM HEAPS 15How does theorem 1.10 translate into playing nim? When the nim sum <strong>of</strong> the heapsizes is zero, then the player is in a losing position. (Such nim positions are sometimescalled balanced positions.) All moves will lead to a winning position, and in practice thebest advice may only be not to move to a winning position that is too obvious, like onewhere two heap sizes are equal, in the hope that the opponent makes a mistake.If the nim sum <strong>of</strong> the heap sizes is not zero, it is some sum <strong>of</strong> powers <strong>of</strong> two, says = 2 a + 2 b + 2 c + ···, like for example 11 ⊕ 16 ⊕ 18 = 9 = 8 + 1 above. The winningmove is then obtained as follows:1. Identify a heap <strong>of</strong> size n which uses 2 a , the largest power <strong>of</strong> 2 in the nim sum; at leastone such heap must exist. In the example, that heap has size 11 (so it is not alwaysthe largest heap).2. Compute n ⊕ s. In that nim sum, the power 2 a appears in both n and s, and it cancelsout, so the result is some number m that is smaller than n. In the example, m =11 ⊕ 9 = (8 + 2 + 1) ⊕ (8 + 1) = 2.3. Reduce the heap <strong>of</strong> size n to size m, in the example from size 11 to size 2. Theresulting heap ∗m is equivalent to ∗n + ∗s, so when it replaces ∗n in the original sum,∗s is added and cancels with ∗s, and the result is equivalent to ∗0, a losing position.On paper, the binary representation may be easier to use. In step 2 above, computingn⊕s amounts to “flipping the bits” in the binary representation <strong>of</strong> the heap n whenever thecorresponding bit in the binary representation <strong>of</strong> the sum s is one. In this way, a playerin a winning position moves always from an “unbalanced” position (with nonzero nimsum) to a balanced position (nim sum zero), which is losing because any move will createagain an unbalanced position. This is the way nim is usually explained. The method wasdiscovered by Bouton who published it in 1902.⇒ You are now in a position to answer all <strong>of</strong> exercise 1.1 on page 20.So far, it is not fully clear why powers <strong>of</strong> two appear in the computation <strong>of</strong> nimsums. One reason is provided by the pro<strong>of</strong> <strong>of</strong> theorem 1.10. The options <strong>of</strong> moving from∗(2 a ) + ∗q in (1.8) neatly produce exactly the numbers 0,1,...,2 a − 1, which would notwork when replacing 2 a with something else.As a second reason, the copycat principle G+G ≡ ∗0 shows that the impartial gamesform a group where every element is its own inverse. There is essentially only one mathematicalstructure that has these particular properties, namely the addition <strong>of</strong> binary vectors.In each component, such vectors are separately added modulo two, where 1⊕1 = 0.Here, the binary vectors translate into binary numbers for the sizes <strong>of</strong> the nim heaps. The“addition without carry” <strong>of</strong> binary vectors defines exactly the winning strategy in nim, asstated in theorem 1.10. However, the pro<strong>of</strong> <strong>of</strong> this theorem is stated directly and withoutany recourse to abstract algebra and groups.A third reason uses the construction <strong>of</strong> equivalent nim heaps for any impartial game,in particular a sum <strong>of</strong> two nim heaps, which we explain next; see also figure 1.2 below.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!