Updated
About Nim Strategy
Nim Strategy is a clean, tactile rendition of one of mathematics’ most celebrated impartial strategy games, created by MCR for TapGameHub. Arranged across four carved wooden trays, sixteen glowing jade stones invite a deceptively simple duel—on your turn, choose any single row and lift away as many stones from that tray as you like. There are no dice rolls, hidden cards or luck-based timers; every position on the board is governed by pure combinatorial logic.
Play face-to-face with a friend in 2P Local mode, randomize pile counts to test raw calculation on the fly, or challenge a Grandmaster AI powered by exact Sprague-Grundy binary Nim-sum theory across both Normal and Misere rule variants.
How to play
- Choose vs Grandmaster for solo brainteasers or 2P Local for two-player table play.
- Check the Rule button in the top bar to pick Normal (taking the last stone wins) or Misere (taking the last stone loses).
- In solo mode, optionally toggle Go: 1st / Go: 2nd—picking first or second matters enormously depending on the starting piles!
- Click or tap any stone inside a row to highlight stones from that gem to the right end of the tray in golden amber.
- Click Take Selected (or press Space / Enter) to remove those stones and pass the turn. Outmaneuver your opponent down to the final stone!
Controls
| Action | Keyboard | Mouse & Touch |
|---|---|---|
| Pick Row 1 to 4 | Keys 1, 2, 3 or 4 | Click or tap stones inside the desired row |
| Change Selected Count | Left / Right or Up / Down Arrows | Tap a different stone in the row (or tap the tray) |
| Confirm Move | Enter or Space | Tap Take Selected button |
| Switch Normal / Misere | Rule button in top bar | Tap Rule button |
| Deal Random Piles | Random Piles button | Tap Random Piles |
Mathematical rules and Grandmaster AI
- Classic 1-3-5-7 setup mirrors the famous four-heap parlor arrangement where binary Nim-sum equals zero (
1 XOR 3 XOR 5 XOR 7 = 0), rewarding the second player under error-free play. - Random Piles generator deals fresh four-row distributions where the opening Nim-sum is frequently non-zero, letting the first player seize immediate control by zeroing the XOR balance.
- True Misere endgame logic shifts strategy right before the final multi-stone pile disappears—leaving an odd number of single-stone piles forces your opponent to claim the fatal last gem.
- Career win tracker records every solo triumph you earn against the Grandmaster AI.
Strategy tips
- Split piles into binary powers of 1, 2 and 4. Mentally decompose every row count into powers of two (for instance,
7 = 4 + 2 + 1and5 = 4 + 1). Whenever every power of two appears an even number of times across all four rows, the player about to move is in a losing trap! - Choose Go 2nd on the classic 1-3-5-7 board. Because
1-3-5-7already pairs off every binary bit evenly, letting the Grandmaster AI move first forces it to break symmetry so you can restore even pairs on every reply. - Watch the Misere pivot point. Play Misere exactly like Normal Nim until only one row contains two or more stones; on that crucial turn, reduce that row to either
1or0so you leave an odd total of single-stone rows behind. - Create twin piles in casual 2P games. Against human opponents, leaving two equal rows (such as
0, 4, 4, 0under Normal rules) lets you mirror whatever your friend does on the opposite row to guarantee victory.
Frequently asked questions
What is the difference between Normal and Misere Nim rules?
Under Normal rules the player who removes the very last stone on the board wins; under Misere rules taking the final stone makes you lose, forcing a clever endgame twist.
Can the Grandmaster AI actually be beaten on the classic 1-3-5-7 board?
Yes! Because 1, 3, 5, 7 starts with a balanced binary XOR sum of zero, choosing Go 2nd in the top bar puts YOU in the mathematically winning seat if you play without error.
How many stones am I allowed to remove on a single turn?
You must remove at least one stone, and you may take as many stones as you wish—even an entire row—provided every stone you take comes from the same row.
Can I generate fresh pile sizes instead of 1-3-5-7 every time?
Yes. Click the Random Piles button below the board at any moment to deal four unpredictable stone counts so neither player can rely on memorized openings.
Does Nim Strategy support two human players on one screen?
Yes. Switch the top toggle to 2P Local to play head-to-head turns on the same computer, tablet or phone under either Normal or Misere rules.
Game not loading or controls not responding? See help with loading, controls and saves.