Chocolate Bar Game (Disguised Nim)

126 Views Asked by At

An $m * n$ chocolate bar can be broken in the usual way, players take turn to break the bar and the last player is the one who is left with the poison square which is marked somewhere on the bar and must eat it, losing the game.

An example game, the player left with the poison square and nothing else has lost as they are forced to eat it:

This is clearly Nim of some sort, and I've seen multiple answers which confirm this and suggest the rows/columns above, below and to either side of the poison bar should each be one item in 4 heaps, each corresponding to one direction - however I don't fully understand this. Take the example above: initially we start with 4 heaps:

Heap 1 (above): 2 items
Heap 2 (below): 1 item
Heap 3 (left): 1 item
Heap 4 (right): 1 item

After the first move, which heap would we remove an item from? Say it's the bottom heap (Heap 2) then there will be no remaining items in that Heap and we would have no heap to remove items from if the next turn another single bottom square was removed, say the middle one. The same argument applies to the other heaps.