📛 Spoiler heads-up: This page reveals the math trick that powers most of the upper floors. Try Floors 3, 4, and 5 yourself first if you want the discovery joy. Come back anytime.
🧠 The Big Idea — One Trick To (Almost) Rule Them All
Three of the upper floors run on the SAME hidden math — and one floor breaks it on purpose. Once you see the trick, you can spot it everywhere. We'll build it up in 5 steps.
🪞 Step 1 — The mirror game
Imagine two piles with 5 stones each. Take any number from ONE pile. Last stone WINS. You go second.
- They take 3 from Pile A → you take 3 from Pile B.
- They take 1 from Pile B → you take 1 from Pile A.
- Pile sizes always match again after your move.
You always win. They keep breaking the match; you keep restoring it. Eventually one pile is empty AND the other is empty — and you took the last move. 🏆
Rule discovered: if the piles MATCH, the second player wins by copying.
🤔 Step 2 — But what if there are THREE piles?
Try [1, 2, 3]. You can't just copy — three piles, odd one out. Or is there?
Watch this: the 3-pile is secretly a 1-pile AND a 2-pile mashed together (because 1 + 2 = 3).
So [1, 2, 3] is REALLY [1, 2, 1+2] = two 1-pieces and two 2-pieces. Perfectly paired! 🎉
Whoever moves first BREAKS the pairing. The other one keeps re-pairing — and wins.
🍁 Step 3 — Every number is a "coin bag"
Here's the magic. Every number is ONE specific bag of power-of-2 coins — one 1-coin, one 2-coin, one 4-coin, one 8-coin, etc. (Never two of the same!)
1 → 1
2 → 2
3 → 1 + 2
4 → 4
5 → 1 + 4
6 → 2 + 4
7 → 1 + 2 + 4
8 → 8
11 → 1 + 2 + 8
Once you know the coin bag for each pile, you can ask: "Are all the 1-coins paired? The 2-coins? The 4-coins?"
🧪 Step 4 — The pairing test in action
Three piles: [3, 5, 6].
3 → 1 + 2
5 → 1 + 4
6 → 2 + 4
─────────────────
1-coins: 2 ✓ (paired)
2-coins: 2 ✓ (paired)
4-coins: 2 ✓ (paired)
Every column even. Perfectly paired — bad turn to be on. Whatever you do, you'll break a column.
Now try [3, 5, 7]:
3 → 1 + 2
5 → 1 + 4
7 → 1 + 2 + 4
─────────────────
1-coins: 3 ❌ unpaired!
2-coins: 2 ✓
4-coins: 2 ✓
The 1-coins are odd. You can win! Find the move that makes every column even. Try: take 1 from the 7-pile → board becomes [3, 5, 6] → all paired ✓. Now THEY'RE stuck.
📛 Step 5 — Reveal: you just invented XOR
That column-check — "is the count odd or even?" — is exactly XOR. Mathematicians write it ⊕.
- XOR = 0 → every column even (perfectly paired). Bad for the player whose turn it is.
- XOR ≠ 0 → some column odd (unpaired). That player can find a fix and win.
That's the whole secret. Hand your opponent a board with XOR = 0.
🗼 Where does XOR rule in Nim Tower?
- Floor 3 (Greedy Glenn) — Pure XOR. The textbook case. Leave Glenn at XOR = 0.
- Floor 4 (Master Mira) — XOR + endgame flip. Use XOR almost the whole game. When every non-empty pile holds exactly 1 gem, FLIP the rule: leave ODD count of 1-piles so Mira takes the last (and loses).
- Floor 5 (Perfect Pixel) — XOR on HALF the board. Marbles cascade down stairs. Only ODD-numbered Steps count for the pairing trick. Even Steps are decoys — you mirror through them.
- Floor 1 & Floor 2 are tiny versions: one pile = one column to balance. "XOR = 0" reduces to "leave a multiple of K+1" (or 75 minutes for Chronos).
🪜 A closer look — Why F5 only counts HALF the Steps
Pixel's staircase is the trickiest case in the tower. The XOR pairing rule still works — but only on ODD-numbered Steps (Step 1, 3, 5…). Why don't moves from EVEN-numbered Steps count? The answer falls right out of two physical rules of the staircase.
🔢 First — count the rolls each marble needs
The staircase has two physical rules:
- Marbles slide DOWN one Step at a time.
- The Floor only receives marbles from Step 1 — that's the only way off the staircase.
So for any marble, you can count its trip — how many rolls it needs to leave. The trip equals its Step number:
Step 1 → 1 roll (Step 1 → Floor) ← ODD
Step 2 → 2 rolls (Step 2 → Step 1 → Floor) ← EVEN
Step 3 → 3 rolls (Step 3 → Step 2 → Step 1 → Floor) ← ODD
Step 4 → 4 rolls ← EVEN
Now imagine the staircase has only ONE marble. You and Pixel take turns rolling it. After EXACTLY k rolls (where k is its starting Step), the marble disappears into the Floor and the game ends. Whoever made the k-th roll wins (they took the last move).
- Marble on Step 1 → 1 roll → mover WINS. You'd love it to be your turn. ← Step 1 MATTERS
- Marble on Step 2 → 2 rolls → mover LOSES (the OTHER player rolls it off). Step 2 is a hot potato — whoever starts it, ends up handing it to the opponent. ← Step 2 doesn't matter
- Marble on Step 3 → 3 rolls → mover WINS. ← Step 3 MATTERS
- Marble on Step 4 → 4 rolls → mover LOSES. ← Step 4 doesn't matter
- Marble on Step 5 → 5 rolls → mover WINS. ← Step 5 MATTERS
That's the split, falling straight out of the two rules:
- Marbles on ODD Steps take an ODD number of rolls. Whoever rolls first on that marble also rolls it last → ODD-Step marbles tilt the turn balance in their mover's favor.
- Marbles on EVEN Steps take an EVEN number of rolls. The two players split them perfectly — whoever starts on that marble ends up handing the last roll to their opponent. EVEN-Step marbles cancel out the turn ledger.
So ODD Steps decide the game; EVEN Steps just shuffle turns evenly between you and Pixel. That's the deepest reason for the half-and-half split.
Now we'll see HOW this plays out when there are many marbles on many Steps at once — using a vivid picture small kids can hold in their head.
🦘🍯 Pretend the Steps are bouncy or sticky
Imagine the Staircase has two kinds of Steps:
- 🦘 ODD Steps (Step 1, 3, 5…) are BOUNCY, like trampolines. Marbles that LAND on a bouncy Step don't get to rest — you can bounce them straight down to the next Step for free.
- 🍯 EVEN Steps (Step 2, 4…) are STICKY, like honey. Marbles that land on a sticky Step stay put.
Now watch what happens for each kind of move Pixel can make. (Marbles always slide DOWN one Step — so an odd Step always leads to even, and an even Step always leads to odd.)
🍯 → 🦘 Sticky-to-bouncy = a "ghost turn"
Pixel rolls marbles from a sticky Step (say Step 2) down to the bouncy Step below (Step 1). The marbles land on a trampoline → 🦘 BOING! → YOU push them off to the Floor (or to the next sticky Step, if it's Step 3 rolling to Step 2).
After both moves: the bouncy Step is BACK to its original count. The marbles ended up either off the board or on another sticky Step. Pixel didn't actually accomplish anything — she just delivered marbles for you to bounce out.
That's why we call EVEN Steps decoys. Moves from them are ghost turns: they happen, but they don't change who wins.
🦘 → 🍯 Bouncy-to-sticky = a REAL move
Pixel rolls marbles from a bouncy Step (say Step 3) down to a sticky Step (Step 2). The marbles land on sticky → they STAY. The bouncy Step's count just went DOWN.
This is a real move. The bouncy-Step XOR changed. You respond by finding ANOTHER bouncy-Step move that restores the pairing — exactly the Nim trick you learned earlier.
(One special case: Step 1 → Floor is a bouncy Step rolling marbles off the staircase entirely. Marbles never come back from the Floor.)
🧪 The worked example
Position: Step 1 = 4 marbles, Step 2 = 3, Step 3 = 4. Bouncy-XOR = 4 ⊕ 4 = 0. You end your turn here. Hand it to Pixel.
She decides to try the decoy: "3 marbles from Step 2 to Step 1." Step 1 jumps from 4 to 7. The bouncy-XOR changed.
You respond: "3 marbles from Step 1 to the Floor." Step 1 is back to 4. Bouncy-XOR back to 0.
Pixel: 3 marbles, Step 2 → Step 1. (Step 1: 4 → 7)
You: 3 marbles, Step 1 → Floor. (Step 1: 7 → 4)
─────────────────────────────────────────────────────
Result: Step 2 lost 3 marbles.
Step 1 unchanged.
3 marbles ended up in the Floor.
Bouncy-XOR: UNCHANGED ✓
Two turns passed, 3 marbles left the board — but the bouncy-Step counts (1 and 3) didn't budge. Pixel's decoy move was a ghost turn.
The bounce works for ANY sticky-Step move she tries:
- Step 2 → Step 1 — you mirror Step 1 → Floor.
- Step 4 → Step 3 — you mirror Step 3 → Step 2.
- Step 6 → Step 5 — you mirror Step 5 → Step 4.
Pattern: marbles bounce THROUGH a bouncy Step and end up on the next sticky Step (or off the Floor). The bouncy Step is conserved.
🎯 The takeaway — control the bouncy Steps
To win, control the XOR of bouncy (odd-numbered) Steps. Hand Pixel a board where bouncy-XOR = 0:
- If she rolls 🍯 → 🦘 (a decoy move): you bounce — no harm done.
- If she rolls 🦘 → 🍯 or 🦘 → Floor (a real move): she breaks the pairing, but you re-pair on your next turn.
Either way, after your move the bouncy-XOR is back to 0 and Pixel is stuck. Eventually she runs out of sticky marbles AND bouncy options — and you took the last move. 🏆
(The technical names mathematicians use are "matter-Steps" for the bouncy ones and "decoys" for the sticky ones. The general theorem behind all of this is called Sprague-Grundy: you can XOR any independent sub-games. The magic of Staircase Nim is that the cascade structure secretly makes only HALF the Steps into "real" sub-games — the other half are mirror-partners that always cancel out.)
💥 Where it BREAKS — Floor 6 (Tricky Tara)
Tara's floor has a new move type: the ↘ Take Both diagonal. That move changes BOTH piles at once.
The pairing trick needs the piles to be independent — what happens in one pile shouldn't depend on what happens in another. The diagonal move ties the two piles together, so the XOR pairing test stops working.
That's why Tara is the boss. She expects you to reach for XOR. You have to throw it out and use a completely different invariant — the golden ratio (φ ≈ 1.618).
🏝️ But WHY does the golden-ratio strategy work?
This is the deepest "why" in the whole tower. Here's a picture small kids can hold:
🌊 Golden pairs are ISLANDS in an ocean
Imagine every (Pile 1, Pile 2) position is a place in a big ocean. Most positions are open water — you can sail around freely. But a few special positions are islands (these are the golden pairs):
(0, 0), (1, 2), (3, 5), (4, 7), (6, 10), (8, 13), (9, 15), (11, 18), (12, 20), (14, 23)…
🪄 Magic property #1: from any island, every boat ride lands you in open ocean. You can NEVER hop directly from one golden pair to another.
🪄 Magic property #2: from open ocean, you can ALWAYS find an island to land on. There's always (at least) one move that gets there.
So the game becomes:
- You on an island → bad! Every move takes you to the ocean. Tara finds an island next turn.
- You in the ocean → good! Find the island, land Tara on it.
🎯 What makes them islands? The unique-difference rule
Look at the difference between the two numbers in each golden pair:
(1, 2) → difference = 1
(3, 5) → difference = 2
(4, 7) → difference = 3
(6, 10) → difference = 4
(8, 13) → difference = 5
(9, 15) → difference = 6
(11, 18) → difference = 7
(12, 20) → difference = 8
(14, 23) → difference = 9
Each golden pair has a UNIQUE difference — no two pairs share one. That gives the islands their "you can't hop between them" magic:
- ↘ Diagonal moves (take same from both) KEEP the difference. So you can't escape to a different-diff island this way.
- Single-pile moves CHANGE the difference. But the island at the new difference is at a specific (Pile 1, Pile 2) — usually not where you'd land.
The math works out so that from any golden pair, EVERY move lands you in the open ocean. The unique-diff property is what locks the islands away from each other.
🍁 Where does the golden ratio come in? (And why "golden" pairs?)
Look at the SMALL number of each golden pair:
1, 3, 4, 6, 8, 9, 11, 12, 14, 16, 17, 19, 21, …
And the BIG number:
2, 5, 7, 10, 13, 15, 18, 20, 23, 26, 28, 31, 34, …
Combine these two lists in order: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, … — every positive integer shows up in exactly ONE golden pair, either as the small one or the big one. Never both. Never missing.
This "every number gets exactly one partner" structure is called a partition. And here's the kicker: the golden ratio (φ ≈ 1.618) is the ONLY number on the entire number line that can split the positive integers into a partition like this, using the rule:
- Small numbers = ⌊1·φ⌋, ⌊2·φ⌋, ⌊3·φ⌋, … = 1, 3, 4, 6, 8, 9, 11, …
- Big numbers = ⌊1·φ²⌋, ⌊2·φ²⌋, ⌊3·φ²⌋, … = 2, 5, 7, 10, 13, 15, 18, …
So when you see the golden ratio in this game, it's not mystical — it's the only number with the property "perfectly partitions the integers into the small members and big members of the pairs." Out of all numbers in the universe, exactly ONE makes Wythoff work. That number happens to be the same φ that shows up in nautilus shells, sunflowers, and pinecone spirals. The golden ratio creates the golden pairs — the name is honest both ways.
(The math name for this kind of partition is a Beatty sequence pair. The theorem behind it: ⌊n·r⌋ and ⌊n·s⌋ partition the positive integers if and only if 1/r + 1/s = 1, with both irrational. The golden ratio's defining property is φ² = φ + 1, which gives 1/φ + 1/φ² = 1. That's why it's the one.)
🌀 Bonus floor — Pulse (Yo-yo Yuna)
If you've climbed to F7, you've met Yo-yo Yuna and her reactive rule: "how high you throw it, that's how high it bounces back." Whatever you catch this turn, Yuna can catch up to twice that next turn. Plus there's a set of magic pile sizes called P-positions where every move she has loses: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89… Your job is to land Yuna on one. But WHY does that strategy work? Time for a picture small kids can hold:
🪀 Pretend the yo-yos are arranged in clumps
Picture the pile of yo-yos in front of you. You have a SCOOP that grabs some. Yuna's scoop is special: it's ALWAYS exactly twice the size of the one you just used. If you scooped 1, Yuna's scoop can hold 2. If you scooped 3, hers can hold 6.
The yo-yos in the pile are secretly arranged in invisible CLUMPS of magic sizes:
(1) 🪀
(2) 🪀🪀
(3) 🪀🪀🪀
(5) 🪀🪀🪀🪀🪀
(8) 🪀🪀🪀🪀🪀🪀🪀🪀
(13) 🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀
(21) 🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀🪀
That's 1, 2, 3, 5, 8, 13, 21… each clump = the two clumps before it stacked together:
- 2 + 3 = 5
- 3 + 5 = 8
- 5 + 8 = 13
- 8 + 13 = 21
These are called Fibonacci numbers, named after Leonardo of Pisa (~1200 AD) who used them to model rabbit reproduction. Same numbers appear in pinecones, sunflowers, nautilus shells — and yes, Yuna's pile.
🎯 The trick — take the SMALLEST clump
Every non-Fibonacci pile size can be broken into clumps. For example:
19 = 13 + 5 + 1
11 = 8 + 3
20 = 13 + 5 + 2
12 = 8 + 3 + 1
33 = 21 + 8 + 3 + 1
The trick is simple: scoop the smallest clump.
What happens? Yuna's scoop grows to twice your scoop. But here's the magic: the NEXT clump in line is MORE than twice the smallest one. (Because every clump = "the one before" + "the one TWO before" — definitely bigger than 2× the smallest.) So Yuna's scoop is just barely too small to grab a whole clump.
She has to scoop less — eating PART of the next clump and leaving a tiny leftover. On YOUR next turn, you scoop the leftover (it's small — fits your hand). Repeat.
The pile shrinks one clump at a time. Yuna's scoop is always JUST too small to skip ahead. You always have a perfectly-sized bite to take. Eventually the pile is empty — and YOU caught the last yo-yo. 🪀
🧪 Worked example — your pile is 19
19 = 13 + 5 + 1. One big clump of 13, one middle clump of 5, one tiny clump of 1.
You scoop the smallest clump = 1. Yuna's scoop grows to 2.
Yuna stares at the remaining 18 yo-yos = a 13-clump + a 5-clump. She'd LOVE to scoop the 5-clump whole. But 5 won't fit in her scoop of 2. She has to take 1 or 2 — eating PART of the 5-clump.
Say she takes 2 → leaves 16 = a 13-clump + a 3-clump. You scoop the new smallest clump = 3. Yuna's scoop grows to 6.
Yuna stares at the 13-clump. She'd LOVE to grab it whole. But 13 > 6 — too big for her scoop. She has to take 1-6, eating part of the 13.
And so on. Every turn, Yuna's scoop is just too small to finish a clump. You always have a clean leftover to scoop. Eventually the pile is gone and you caught the last yo-yo.
✨ The big reveal — this is the SAME magic as F6
The reason every clump is "more than 2× the one before" is exactly because of the golden ratio φ ≈ 1.618. Each Fibonacci clump is roughly φ² ≈ 2.618 times bigger than the one two places back:
13 / 5 = 2.6
21 / 8 = 2.625
34 / 13 = 2.615
55 / 21 = 2.619
…
limit → φ² ≈ 2.618
And Yuna's scoop only grows by 2. Since 2 < 2.618, her scoop can NEVER catch up to a full clump. That's the entire reason her strategy fails.
The same φ that creates F6's golden pairs is HIDDEN INSIDE the Fibonacci sequence:
2 / 1 = 2.000
3 / 2 = 1.500
5 / 3 = 1.667
8 / 5 = 1.600
13 / 8 = 1.625
21 / 13 = 1.615
…
limit → φ ≈ 1.618
Tara's golden pairs and Yuna's Fibonacci clumps are two faces of φ. Tara uses φ directly (⌊n·φ⌋ and ⌊n·φ²⌋). Yuna uses the Fibonacci sequence (which secretly carries φ inside it). Either way: the golden ratio decides who wins.
(The math name for "every number breaks into non-consecutive Fibonacci clumps in exactly one way" is Zeckendorf's theorem. The strategy you just learned is called the Zeckendorf decomposition. The general property "smallest piece × 2 < next piece" comes from the identity Fk+2 = Fk+1 + Fk > 2·Fk.)
🎓 The big takeaway
XOR is the math of independent sub-games. When piles don't talk to each other, XOR combines them perfectly. When something twists that — Mira's flip, Pixel's cascade, Tara's diagonal, Yuna's reactive cap — the math has to twist too.
Nim Tower's seven floors are the SAME ideas stretched, twisted, and recombined. You're not learning seven different tricks. You're learning a small handful of deep ideas (pairing → XOR → sub-game decomposition → golden ratio) and watching them evolve. 🌱