Nim is a classic mathematical strategy game that has fascinated players for over a century. Take the last stone to win. Every move is a decision — no dice, no cards, no luck.
Play Nim Duel Now →Nim has a perfect mathematical solution. If you know it, you can win against any opponent who doesn't — guaranteed. Here's the core idea:
Write each pile size as a binary number. Compute the XOR of all three pile sizes:
nimSum = pile1 XOR pile2 XOR pile3
If the result is zero, you're in a "losing" position — you'll lose against perfect play. If it's not zero, you're in a "winning" position — you can force a win.
When nimSum ≠ 0, find a pile where pile XOR nimSum < pile. Reduce that pile to that new value. This leaves your opponent with nimSum = 0 — a losing position.
With piles of 3, 5, 7: 3 XOR 5 XOR 7 = 1. So it's a winning position for the first player. The winning move is to reduce pile 1 from 3 → 2, because 3 XOR 1 = 2.
Nim has zero randomness. Every outcome is determined by the players' decisions. A player who knows the XOR strategy will defeat any opponent who doesn't — 100% of the time. That's why Nim is one of the purest skill-based games in existence.
SkillClash has 21+ skill-based games. Here are a few more you can play right now: