Breaking chocolate bars game

4.1k Views Asked by At

About two weeks ago, a friend of mine taught me the following game without his knowing the answer. It may be famous, but I haven't known it.

There are $N\ (\in\mathbb N)$ chocolate bars composed of $a_i\times b_i\ (i=1,2,\cdots, N)$ squares of chocolate. Here, suppose that $a_i$ is the length of the vertical edge of each square, and that $b_i$ is the length of the horizontal edge of each square. Also, let $a_i,b_i$ be natural numbers. (see below. $N=4$ case.)

$\ \ \ \ $enter image description here

Two players $A, B$ take turns picking up a piece of chocolate and cutting it along the grid lines. A player cuts through and creates a new pieces. The first player $A$ always has to cut it horizontally. The second player $B$ always has to cut it vertically. One must not turn around the squares. A player that has no place to cut loses. (see below. $N=3$ case in which the game will be continued.)

$\ \ \ \ $enter image description here

Examples : If there is a chocolate bar composed of $3\times 2$ squares of chocolate, then the player $B$ wins. If there is a chocolate bar composed of $4\times 2$ squares of chocolate, then the player $A$ wins.

Question : In what cases does the player $A$ win? Why?

I have a conjecture.

My conjecture : The player $A$ wins $\iff \sum_{i=1}^{N}\lfloor \log_2 a_i\rfloor\gt \sum_{i=1}^{N}\lfloor\log_2 b_i\rfloor$ holds.

This seems true for $N=1$ case and some other smaller cases, but I don't think I've succeeded in proving this strictly. Of course it may not be true. Can anyone help?

Edit : I edited the notation. I hope this time is not confusing.

2

There are 2 best solutions below

9
On BEST ANSWER

This is a combinatoric game. Using Conway notation, you can show that this game is always a number (cold game) and always an integer.

Let $A$ be the Left player and $B$ be the Right player.

Then show that the value $v$ of $(a,b)$ verifies :

  1. $v(a,b)=-v(b,a)$

  2. for $a\ge b$, let $|x|$ the number of bits in the binary representation of $x$ ($|0|=0$, $|1|=1$, $|2|=|3|=2$, |4|=|5|=|6|=|7|=3, etc). Then $$v(a,b)=\left\lfloor\frac{a}{2^{|b|-1}}\right\rfloor-1 $$

So if $A$ begins, he has a winning strategy as long as long as $a\ge 2^{|b|}$ (he needs $v>0$ to win)

If there are several pieces :

$$\mbox{A has a winning strategy} \Longleftrightarrow \left(\sum_i v(a_i,b_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&1 &1 &1 &1 &1 &1 &0 \end{array} $$

EDIT (long answer to a comment) :

Yes, this is a cold game, so each time a player plays, the situation become worse for him. So skipping his turn is good.

All those (cold) games can be represented by a number (not necessarily an integer, it could be a real, or an ordinal). Here the game is simple, and we only get integers.

So the integer value of the game is how many turn a player can skip his turn and still lose. So if $v(a,b)=3$, $B$ can skip 3 times (assuming $B$ begins) and still lose (so this is a good game for $A$). The same for $v(a,b)=-3$ but you exchange $A$ and $B$. $v(a,b)=0$ means the first player will lose.

Usually, to compute the value of a situation $s$, we compute all values of all situations any player can go from $s$, and use the usual theory to infer the initial value (again "On numbers and games"). But you're right in your remarks and perhaps you can simply prove the values by reasoning on "how many times first player can cut at first without losing". But I guess you will just have to rebuild the theory in this particular case. You can't do without it on such games. Read the book !

6
On

This game is called Cutcake, and it is explicitly analyzed in both "On Numbers and Games" and "Winning Ways". (For some reason the spam-blocker thinks this answer is spam; not sure why.)