Arjun and Beth play a game in which they take turns removing one brick or two adjacent bricks from one "wall" among a set of several walls of bricks, with gaps possibly creating new walls. The walls are one brick tall. For example, a set of walls of sizes and can be changed into any of the following by one move: or

Arjun plays first, and the player who removes the last brick wins. For which starting configuration is there a strategy that guarantees a win for Beth?
- A)
- B)
- C)
- D)
- E)
Answer
B
Key insight
If the walls come in identical pairs, the second player wins by copying each move on the twin wall. In every wrong choice, Arjun can make such pairs at once.
Solution
Step 1: a winning idea, the copycat strategy.
- Suppose the walls come in identical pairs, like or . Then the player who moves second can always win: whatever the other player does to one wall, copy the same move on its twin. After each copy the walls are in identical pairs again.
- So the copying player always has a move, and the other player eventually runs out. The copier takes the last brick and wins.
- This means: if a player can move to "identical pairs," that player wins, by copying from then on.
Step 2: rule out four choices. In each of these, Arjun (moving first) can split the -wall so that everything comes in identical pairs. Then Arjun copies Beth and wins.
- : Arjun removes the two middle bricks of the (bricks and ), leaving and . Walls: .
- : the same move gives .
- : Arjun removes bricks and of the , leaving and . Walls: .
- : Arjun removes brick of the , leaving and . Walls: .
Step 3: conclude. Arjun wins in (A), (C), (D) and (E), so the configuration where Beth can guarantee a win is .
The answer is .
Why this works
In many two-player games, the player who can make the position symmetric wins by copying. Here a single move in the middle of the long wall can create the twin walls. The Alternative Approach below shows how to confirm directly that Beth really does win from .
Alternative approach
Give each wall a "game number" and combine them.
- Game number of one wall. List every position you can move to from that wall, find their game numbers, and take the smallest whole number () that is not in the list.
- Several walls. Write each wall's game number in binary and add the columns without carrying (a column is if it has an odd number of s). This is called XOR, written . For example, .
- The player about to move loses exactly when the combined number is .
The table of game numbers (an empty position has game number ):
| wall | positions you can reach | their numbers | game number |
|---|---|---|---|
| nothing left | |||
| , nothing | |||
For : . So Arjun, who moves first, loses, and Beth wins. For the other four choices the combined number is not .
The trap
Treating this like ordinary Nim with piles 6, 2, 1, forgetting that taking bricks from the middle of a wall splits it into two walls.
Concise solution
This is a sum of independent games (the walls), so use nim-values. Assign each wall size a value : the smallest nonnegative integer not among the values of positions reachable from a single wall of , where a multi-wall position's value is the XOR () of its walls' values. The player to move loses exactly when the total XOR is .
Compute, listing the positions reachable from one wall:
| reachable positions | their values | ||
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 |
Beth, the second player, wins when the starting XOR is :
- : .
- : . Beth wins.
- : .
- : .
- : .
Only is a losing position for the first player.
The answer is .
Review in the AoPS books
- Intermediate Counting & Probability, Chapter 13: Events With States (§13.4)
- Intermediate Counting & Probability, Chapter 10: Recursion
- Introduction to Algebra, Chapter 22: Special Manipulations (§22.3)
- Introduction to Counting & Probability, Chapter 3: Correcting for Overcounting (§3.4)
Techniques
Define states/recurrence and iterate · Exploit symmetry to reduce work or pair up objects