The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The Game of Nim

The last player to make a move wins.

The Game of Nim

has perfect information,

(nothing is hidden from either player, unlike, e.g, a lot of card games)

is impartial,

(both players have the same moves available)

& is played according to the normal play convention.

(the last player to make a move wins, as opposed to misére play,
where the last player to make a move loses)

deterministic,

(no randomization by way of shuffles, coin tosses, die rolls, etc.)

...a turn based two-player game,

The Game of Nim

has perfect information,

(nothing is hidden from either player, unlike, e.g, a lot of card games)

is impartial,

(both players have the same moves available)

& is played according to the normal play convention.

(note: there are no draws)

deterministic,

(no randomization by way of shuffles, coin tosses, die rolls, etc.)

...a turn based two-player game,

The Game of Nim

We often want to know...

WHO WINS?

The Game of Nim

A player might win because she played well 🎉

A player might also win because the other player played badly 👀

We will mostly focus on forced wins.

We want to know if a player can win...
no matter how the other player plays.

A winning strategy is a formula for
playing-to-win.

The Game of Nim

Strategy

Game Position

move

The Game of Nim

Strategy

Game Position

move

Can both players have a winning strategy?

The Game of Nim

Strategy

Game Position

move

Will at least one player have a winning strategy?

The Game of Nim

Strategy

Game Position

move

Let us work through some examples!

The Game of Nim

The Game of Nim

The Game of Nim

The first player wins by eliminating the whole heap.

The Game of Nim

What if there are two equal heaps?

The Game of Nim

What if there are two equal heaps?

The Game of Nim

What if there are two equal heaps?

The Game of Nim

What if there are two equal heaps?

The Game of Nim

What if there are two equal heaps?

...back to square one.

The Game of Nim

What if there are two equal heaps?

as soon as the first player empties out a heap,

the second player empties out the other one.

The Game of Nim

The second player can force a win.

as soon as the first player empties out a heap,

the second player empties out the other one.

The Game of Nim

The second player can force a win.

(a = b)

This is true of the the losing position.

a

b

Making any move on a board that has the property destroys it.

If the property does not hold, there exists a move that restores it.

The Game of Nim

(a = b)

This is true of the the losing position.

Making any move on a board that has the property destroys it.

If the property does not hold, there exists a move that restores it.

all two-heap

NIM games

with equal-sized

heaps

all two-heap

NIM games

with unequal

heaps

Making any move on a board that has the property destroys it.

\(\forall\)

\(\exists\)

The Game of Nim

If the starting position has the property, player 2 wins.

(a = b)

This is true of the the losing position.

a

b

Making any move on a board that has the property destroys it.

If the property does not hold, there exists a move that restores it.

The Game of Nim

If the starting position does not have the property, player 1 wins.

(a = b)

This is true of the the losing position.

a

b

Making any move on a board that has the property destroys it.

If the property does not hold, there exists a move that restores it.

The Game of Nim

Who wins this Nim game?

a

b

The Game of Nim

Who wins this Nim game?

a

b

The Game of Nim

This game belongs to Player 1.

a

b

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Player 2... when \(N\) is even.

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Player 2... when \(N\) is even.

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Player 1... when \(N\) is odd.

Upgrade: \(N\) heaps!

Assume every heap has just one token.

The only choice a player has
is to figure out which heap to take from.

But this is not much of a choice either,
since all heaps are basically identical.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

If \(N\) is even, the second player can win by grouping and mirroring.

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

If \(N\) is odd, the first player can win by reducing to the even case.

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

If \(N\) is odd, the first player can win by reducing to the even case.

Upgrade: \(N\) heaps!

Assume every heap has two tokens.

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) and \(b\) are both even?

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) and \(b\) are both even?

Player 2 wins (by mirroring and grouping again).

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) is odd and \(b\) is even?

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) is odd and \(b\) is even?

Player 1 wins (by removing one heap with two tokens).

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) is even and \(b\) is odd?

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) is even and \(b\) is odd?

Player 1 wins (by removing one heap with one token).

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) is odd and \(b\) is odd?

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

What if \(a\) is odd and \(b\) is odd?

Player 1 wins (by removing one token from one two-heap).

The Game of Nim

Who wins?

Upgrade: \(N\) heaps!

Assume every heap has one or two tokens.

\(a\) heaps with two tokens each

\(b\) heaps with one token each

\(a+b\) is even: a feature of the losing state

Can be restored; cannot be preserved.

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 wins.

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 wins.

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 wins.

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 wins.

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 wins.

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 wins.

Consider the following \(3\) heaps:

The Game of Nim

Who wins?

Consider the following \(3\) heaps:

The Game of Nim

Player 2 always wins.

Consider the following \(3\) heaps:

The Game of Nim

Consider the following \(4\) heaps:

\(\vdots\)

\(a\)

tokens

The Game of Nim

Consider the following \(4\) heaps:

\(\vdots\)

\(a\)

tokens

Who wins?

The Game of Nim

Consider the following \(4\) heaps:

\(\vdots\)

\(a\)

tokens

Player 1 wins.

The Game of Nim

Consider the following \(4\) heaps:

\(\vdots\)

\(a\)

tokens

Player 1 wins.

The Game of Nim

Player 1 wins.

Recall this is a loss for whoever starts here.

Consider the following \(4\) heaps:

The Game of Nim

Who wins?

Consider the following \(k\) heaps:

\(p\)

\(r\)

\(q\)

The Game of Nim

Who wins?

Consider the following \(k\) heaps:

\(p\)

\(r\)

\(q\)

The Game of Nim

Who wins?

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If \(p+r\) and \(q+r\) are both even,

then the second player wins by mirroring and grouping.

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

Watch out for breaking groups and
make sure to have a strategy for restoring balance.

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

O

E

E

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

E

remove one 1-heap entirely

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

O

E

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

E

remove one 2-heap entirely

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

O

O

E

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

E

take one pebble out of a 2-heap

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

O

O

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

E

remove one pebble from a 3-heap

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

O

E

O

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

E

remove two pebbles from a 3-heap

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

O

The Game of Nim

If at least one of \(p+r\) or \(q+r\) is odd...

Consider the following \(k\) heaps:

\(p+r\)

\(q+ r\)

\(p~~~~~q~~~~~r\)

E

E

E

remove one 3-heap entirely

The Game of Nim

If there are \(p\) 1-heaps, \(q\) 2-heaps, \(r\) 3-heaps,

 

then player 2 can force a win

if and only if

 

\(p+r\) and \(q+r\) are both even.

Detour: on winning

Strategy

Game Position

move

Will at least one player have a winning strategy?

Active

Passive

Detour: on winning

If all subpositions are first-player wins,

then the second player wins the original game.

Active

Passive

Detour: on winning

If there is a subposition that is a second-player win,

then the first player wins the original game.

Active

Passive

Detour: on winning

Can there be undetermined subpositions?

Active

Passive

Detour: on winning

Can there be undetermined subpositions?

Active

Passive

*Tuck this argument into an induction framework to guarantee that every subposition is winning for at least one player.

Detour: on winning

The Game of Nim

Who wins?

Consider the following \(k\) heaps:

\(a_1, a_2, \ldots, a_k\)

The Game of Nim

👀

Consider the following \(k\) heaps:

\(a_1, a_2, \ldots, a_k\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1,2,2,2,4,4,4,4,4,4,16,32,32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16\)

\(32,32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16\)

\(32,32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16\)

\(32,32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16,16\)

\(32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16,16\)

\(32,32\)

This is a dangerous move!

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16\)

\(32,32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2,2\)

\(4,4,4,4,4,4\)

\(16,16\)

\(32,32\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2,2\)

\(4,4,4,4,4,4\)

\(16,16\)

\(32,32\)

That's the goal, but this is not directly a legal move...

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2,{\color{OrangeRed}2}\)

\(4,4,4,4,4,4\)

\(16,{\color{OrangeRed}16}\)

\(32,32\)

That's the goal, but this is not directly a legal move...

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16\)

\(32,32\)

\(18\)

The Game of Nim

Consider the following \(k\) heaps:

\(1,1,1,1\)

\(2,2,2\)

\(4,4,4,4,4,4\)

\(16\)

\(32,32\)

\(18\)

\( = ``16 + 2"?\)

The Game of Nim

In general, thinking of heap sizes sums of powers of two is useful!

Suppose our heap sizes are \(1,3,4,5,7,9\).

\(1 = {\color{IndianRed}1}\)

\(3 = {\color{IndianRed}1} + {\color{SeaGreen}2}\)

\(4 = {\color{Purple}4}\)

\(5 = {\color{Purple}4} + {\color{IndianRed}1}\)

\(7 = {\color{Purple}4} + {\color{SeaGreen}2} + {\color{IndianRed}1}\)

\(9 = {\color{OrangeRed}8} + {\color{IndianRed}1}\)

# of \({\color{IndianRed}1}\)'s \(\rightarrow\) 5

# of \({\color{SeaGreen}2}\)'s \(\rightarrow\) 2

# of \({\color{Purple}4}\)'s \(\rightarrow\) 3

# of \({\color{OrangeRed}8}\)'s \(\rightarrow\) 1

The Game of Nim

If all the counts on the right are even: the position is balanced.

\(1 = {\color{IndianRed}1}\)

\(3 = {\color{IndianRed}1} + {\color{SeaGreen}2}\)

\(4 = {\color{Purple}4}\)

\(5 = {\color{Purple}4} + {\color{IndianRed}1}\)

\(7 = {\color{Purple}4} + {\color{SeaGreen}2} + {\color{IndianRed}1}\)

\(9 = {\color{OrangeRed}8} + {\color{IndianRed}1}\)

# of \({\color{IndianRed}1}\)'s \(\rightarrow\) 5

# of \({\color{SeaGreen}2}\)'s \(\rightarrow\) 2

# of \({\color{Purple}4}\)'s \(\rightarrow\) 3

# of \({\color{OrangeRed}8}\)'s \(\rightarrow\) 1

If a position is balanced, any move destroys balance.

If a position is not balanced, there exists a move that restores balance.

Win at Nim! (spoiler alert)

The Game of Nim

This makes for neat math* and a nice puzzle!

But there's more! 😎

It turns out that every combinatorial game

is equivalent**

to a single-heap game of Nim,

for a fairly useful notion of equivalence.

*Nim, A Game with a Complete Mathematical Theory · Charles L. Bouton
Annals of Mathematics, Second Series, Vol. 3, No. 1/4 (1901 - 1902), pp. 35-39 (5 pages)

**Sprague-Grundy Theorem (Wikipedia)

Fun fact: numbers associated with Nim games are called Nimbers.

Token Sliding

Token Sliding

Token Sliding

The blue player picks any token and slides it downwards
any number of cells (but not past the red token).

Token Sliding

The red player picks any token and slides it upwards
any number of cells (but not past the blue token).

Token Sliding

Exercise: show that this game is identical to Nim.

Token Sliding

(HINT)

1
2
3
4
2
3
4
1
3
4
1
3
2
4
3
4
3

Red has no moves left, so blue wins!

4

Red has no moves left, so blue wins!

Red has no moves left, so blue wins!

Red has no moves left, so blue wins!

1
2
3
4

If Red starts this game, Blue will win.

Blue: 3

Blue: 4

1
2
3
4

Easy to check: if Blue starts this game, Blue wins again!

Red wins no matter who starts.

If #red > #blue:

Blue wins no matter who starts.

If #red < #blue:

the player who starts cannot win.

If #red = #blue:

Note that unlike Nim, Hackenbush is a partial game.

In Red/Blue/Green Hackenbush,

we also have green branches,

which can be cut by either player.

Nim is a special case of green Hackenbush.

Assigning #'s to Hackenbush games is the start of a thrilling journey with numbers as you have never experienced them before :)

Hackenbush

why do we care?

Finally...

These games are fun!

Do people really get paid to work on them?

These games are useless!

Why would anyone get paid to work on them?

why do we care?

Finally...

These games are fun!

Do people really get paid to work on them?

These games are useless!

Why would anyone get paid to work on them?

There is evidence of actual applications in computer science
(e.g: coding theory, cryptography, logic),
and mathematics
(e.g: combinatorial number theory; graph theory).

why do we care?

Finally...

These games are fun!

Do people really get paid to work on them?

These games are useless!

Why would anyone get paid to work on them?

Games are also useful proxies for reasoning capabilities,
so there is substantial interest in designing computer systems
that can play games well (chess, go, poker, etc).

why do we care?

Finally...

These games are fun!

Do people really get paid to work on them?

These games are useless!

Why would anyone get paid to work on them?

Games are also useful proxies for reasoning capabilities,
so there is substantial interest in designing computer systems
that can play games well (chess, go, poker, etc).

why do we care?

Finally...

These games are fun!

Do people really get paid to work on them?

These games are useless!

Why would anyone get paid to work on them?

Games help with practicing abstractions in a natural way,
and this is foundational to mathematical thinking.

🎁: beautiful views on the journey!

why do we care?

Finally...

These games are fun!

Do people really get paid to work on them?

These games are useless!

Why would anyone get paid to work on them?

\(\ldots\)

Do keep in touch!

@neeldhara (x.com)

neeldhara.misra@gmail.com

www.neeldhara.com

slides.com/neeldhara/nim

Activity session

Toads & Frogs · Domineering · Traffic Jam · SW-Queen

Please pair up with a partner.

Make sure you have seven dominos of the same color,

and your partner has seven dominos of a different color.

Make sure you have three tokens of the same color,

and your partner has three tokens of a different color.

The tokens look like this (and are quite small):

Toads and Frogs is played on a \(n \times 1\) strip of squares.

At any time, each square is either empty or occupied by a single token (toad/frog).

START: the bottom three cells have toads and the top three cells have fronts.

When it is the toad-player's turn to move, they may either:

- move a toad one square upwards, into an empty square, or

- hop a toad two squares upwards, over a frog, into an empty square.

Hops over an empty square, a toad, or more than one square are not allowed.

When it is the frog-player's turn to move, they may either:

- move a frog one square downwards, into an empty square, or

- hop a frog two squares downwards, over a toad, into an empty square.

Hops over an empty square, a frog, or more than one square are not allowed.

The first player to be unable to move on their turn loses. 

Domineering is played on a \(n \times n\) strip of squares,
each player has \(n^2/4\) dominos to play with.

In our tournament, \(n = 4\) and
each player has four dominoes for this game.

One player is a vertical player
and the other player is a horizontal player.

The vertical player places tiles vertically,
while the horizontal player places them horizontally.

Note: Tiles cannot overlap.

On your turn, place a tile in the correct orientation.

The first player to be unable to move on their turn loses. 

Traffic Jam is played on a \(n \times n\) strip of squares,
each player has \(n\) dominos to play with.

In our tournament, \(n = 3\) and
each player has three dominoes for this game.

Begin at the position shown on the right.

On your turn, pick one of your pieces

and move it one cell forward

along the relevant line.

 

Note: tiles cannot overlap,

so if you are blocked on a line, you cannot move forward on it.

The first player to be unable to move on their turn loses. 

Southwest Queen is played on a grid.

Place a single token anywhere on the grid.

On your turn, move the token any number of steps in

ONE of the following directions:

 

1. South (downward)

2. West (leftward)

3. South-west (along the diagonal towards the bottom-left corner)

The first player to reach the bottom-left square wins.

Q: can you come up with a variation of two-heap Nim that is identical to this game?

References

Domineering · Cram (impartial edition)

Traffic Jam is inspired by Rush Hour

SW-Queen is aka Wythoff's game

(might have spoilers)

Nim and Hackenbush

By Neeldhara Misra

Nim and Hackenbush

  • 271