ShadowBot Gaming
⚫ Strategy

NIM

Take 1–3 stones each turn. Don't take the last one.

Your turn
Stones remaining
21

About NIM ⚫ Misère strategy

The classic mathematical game. Take 1, 2, or 3 stones per turn. Whoever takes the last stone loses. The AI plays the perfect optimal strategy — beating it takes opening moves only.

How to play NIM

  1. Click Take 1 / Take 2 / Take 3 to remove that many stones.
  2. AI replies.
  3. Whoever takes the last stone loses.

Tips & strategy

  • Goal: leave your opponent with 1 stone. So leave them 5, 9, 13, 17, 21 (any multiple of 4 + 1).
  • If the count is already a "losing position" for you, your best hope is the AI makes a mistake.
  • Optimal AI starts with a winning position — try to give it bad starting numbers.

FAQ

Can the optimal AI lose?
Only if the starting count puts the AI in a losing position, which 21 stones (default) does for the second player. You're first, so play perfectly.