Labs

Nim

Work backwards from the goal: find the positions you want to leave, and the first move follows.

5 minutes · trains Calculate · points only, never money

There is one pile of counters. You and the bot take turns to take 1, 2 or 3 of them, and whoever takes the last counter wins. You play five games, each with a new pile, and you choose who goes first. The bot plays perfectly whenever it can. Can you find the rule that beats it?

Game
1 of 5
Counters left
You won
0
Bot won
0

Try it yourself

In Nim, each player takes 1, 2 or 3 counters, and whoever takes the last one wins. The pile has 11 and it is your move. How many do you take?

3 questions, a minute or two. Nothing to finish first.

Want more? Practise Calculate.

Read more

  • Backward induction Solve the last decision first, then the one before it, until you reach the move you have to make now.
  • Count it through Follow a sequence of moves to its end before you start it, counting what each side wins.
  • The Calculate course Lessons and practice for the skill this lab trains.

Add Chaalwise to your Home Screen

  1. Tap the Share button in Safari's toolbar.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.