Strategy
Nim
Matchsticks, one rule, and a relentless mathematical strategy.
Take turns removing matches from a single row. Depending on the variant, taking the last one wins or loses. The Master level plays a perfect strategy.
- Players
- 1 or 2 players
- Length
- 3 min
- Against the AI
- Two players on one device
15 days of full access, no account · No download

How to play
Goal
In the normal variant, whoever takes the last match wins. In the misère variant, whoever takes the last match loses.
How it works
- On your turn, remove at least one match, as many as you like, but from a single row.
- Tap a match: it is selected along with all the ones that follow it in the row. Adjust if needed with the − and + buttons, then tap “Take” (or tap the same match again).
- Classic heaps: 1, 3, 5 and 7 matches. Random heaps: three to five rows, always winnable by the player who starts.
Tip: write the size of each row in binary and add up the columns without carrying (the “exclusive or”). If the result is zero, the position is lost for the player who has to move. In the classic 1-3-5-7 layout, the first player therefore starts at a disadvantage against a perfect opponent.
About the AI
The Master level applies the perfect mathematical strategy, based on the Nim-sum (Bouton’s theorem), adapted for the misère variant in the endgame. The lower levels play the perfect move with an increasing probability and otherwise a plausible move, chosen as a human player might.
AI levels
- BeginnerMostly removes matches at random.
- AmateurKnows a few endgames, nothing more.
- IntermediatePlays correctly most of the time.
- ExpertRarely caught out.
- MasterPerfect strategy through the Nim-sum: the slightest mistake will be fatal.
