Quoto

Learn / Library / Brainteasers

Bottles in a row

BrainteasersHard

bottles stand in a row at positions to . players alternate; a move knocks down either standing bottle or standing bottles at neighbouring positions. Bottles never move, so a fallen bottle leaves a gap that splits the row. The player who knocks down the last bottle wins. You move first and both players play optimally. A first move is the set of bottles it knocks down. How many different first moves guarantee you a win?

Checking an answer needs JavaScript. The hint and the solution open without it.

A whole number, a decimal, a fraction like 3/8 or a percent.

Hint

A mirror reply works after a central move, but other first moves may win too: give each segment of the row a value and combine the values.

Solution
  1. Knocking down the bottle at position leaves rows of , and copying every opponent move on the other side then wins, so a winning move exists.
  2. To count all winning moves, give each row of bottles a value : the smallest non-negative whole number not among the XORs of the values of the pieces its moves leave.
  3. This gives to as , , , , , , , , , , , , , , , and a first move wins exactly when the XOR of the values of the rows it leaves is .
  4. No move that removes bottles works, but removing bottle wins when it leaves rows of and , and , or and , in either order.
  5. These are the bottles at positions , , , and , so the answer is .

Answer: