Three-Heap XOR Takeaway
Choose a whole-heap move and explain the resulting bitwise XOR.
Logic & rule checking
- Players
- Exactly 2
- Time
- 10–20 minutes
- Materials
- Printed player sheet or copied paper, pencil and small counters.
Prepare
Make three heaps of 1, 2 and 3 counters. Two players alternate. A move removes one or more counters from exactly one heap.
Follow the rule
Removing the final counter wins. You may take a whole heap. You may not move counters between heaps or pass.
Check each step
Before each move write the three heap sizes in two binary columns. XOR means each column has 1 if its number of ones is odd.
Worked example
Test taking one from the heap of three: the state becomes (1,2,2), so XOR is 1. Explain why the other player can then remove the singleton to reach XOR zero.
Finish and adapt
Play to empty, then replay from (1,2,2) with first player switched. Compare the decisions, not just the winner.
Purpose, observation and provenance
Within this activity: Choose a whole-heap move and explain the resulting bitwise XOR.
Ask the checker to point to the move or calculation that decides the outcome.
Our rules, examples and printable diagrams are separately prepared. The earliest inventor of the broader mechanism is not established here.
Nim and XOR — Rule or mathematical background for our original paper exercise. The small example and end condition are ours.
Free alternative: Copy the supplied grids, labels and cards onto reused paper. No specialist product is needed. Adults may prepare pieces or act as a scribe.
Printable materials
Preview at 100% scale, with browser headers and footers off. Cut with suitable help. Keep host keys separate. This is a manual tabletop kit, not an online opponent, automatic judge or solver.
Three-Heap XOR Takeaway · Player materials
Make three heaps of 1, 2 and 3 counters. Two players alternate. A move removes one or more counters from exactly one heap.
Removing the final counter wins. You may take a whole heap. You may not move counters between heaps or pass.
Before each move write the three heap sizes in two binary columns. XOR means each column has 1 if its number of ones is odd.
| Heap | Initial |
|---|---|
| A | 1 |
| B | 2 |
| C | 3 |
| Step / cell | Decision / value | Rule checked |
|---|---|---|
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
| ________ | ________ | ________ |
Three-Heap XOR Takeaway · Host key — keep separate
1 XOR 2 XOR 3 = 0. After the stated move 1 XOR 2 XOR 2 = 1; taking heap A leaves equal nonempty heaps.
Lead and check
Make three heaps of 1, 2 and 3 counters. Two players alternate. A move removes one or more counters from exactly one heap.
Removing the final counter wins. You may take a whole heap. You may not move counters between heaps or pass.
Before each move write the three heap sizes in two binary columns. XOR means each column has 1 if its number of ones is odd.
Test taking one from the heap of three: the state becomes (1,2,2), so XOR is 1. Explain why the other player can then remove the singleton to reach XOR zero.
Play to empty, then replay from (1,2,2) with first player switched. Compare the decisions, not just the winner.
Use the player count in the rules. A separate observer may audit the log without taking a playing turn. Prepare separate kits for more groups.
Related activities
Activity library · Row removal duel — Printable Materials & Rules