THINKING • STRATEGY • LOGIC

Apple Nim Game

Whoever takes the last apple loses! Can you beat the unbeatable algorithm?

One Row per Turn

On each turn, you may take apples from one row only.

No Take Limit

Take as many apples as you like from the chosen row — even the whole row.

Poison Apple

Whoever takes the final apple loses. Plan every move carefully!

Logical Reasoning With Apple Nim

Apple Nim turns mathematical reasoning into a short strategy duel. You compare the three rows, predict the computer’s reply and decide how many apples to remove. The rules are simple, but every move changes the balance of the whole board.

How the Game Helps

Tracking several possible replies strengthens concentration, planning and decision-making. Repeated games also reveal useful patterns: a strong position is created deliberately, not by taking the largest pile every time.

Poison Apple (Nim)
Leave the last apple to your opponent!
Turn: Your turn

Rules

Take apples from one row only on each turn. You cannot select apples from different rows at once.

Strategy

The algorithm does not make mistakes. Plan several moves ahead if you want to beat it.

What Is Apple Nim?

Apple Nim is a strategy game against the computer. The board starts with three rows containing 3, 5 and 7 apples. On your turn, take one or more apples from a single row. You may clear that row, but you cannot mix apples from different rows in the same move.

The twist is the poison apple: whoever takes the final apple loses. This is the misère version of the classic mathematical game Nim. Chance plays no part, and the computer follows an optimal strategy. To win, you need to recognise a favourable position and keep the balance under control until the endgame.

How to Play

  • You and the computer take turns removing apples.
  • Choose apples from one row only during a turn.
  • Take at least one apple; there is no upper limit within the chosen row.
  • You cannot pass your turn.
  • Force the computer to take the last apple. If you take it, you lose.

Winning Strategy

  • Think in positions, not apples collected. Taking many apples is useful only when it leaves the opponent a weaker board.
  • Learn the Nim sum. Write each row size in binary and apply XOR. While more than one row contains multiple apples, aim to leave a Nim sum of zero.
  • Expect the endgame rule to change. Once every non-empty row contains one apple, leave your opponent an odd number of those rows.
  • Look for symmetry. Two equal rows can often be controlled by copying the opponent’s removal in the other row.
  • Plan the reply before moving. Ask what the computer can remove next and whether you can restore a balanced position.
  • If the position is already losing, create choices. A complicated board gives the opponent more chances to make an error than an obvious finish.

What Does It Train?

  • Backward reasoning: start from the final move you want and work towards the current position.
  • Pattern recognition: repeated row combinations reveal winning and losing states.
  • Binary intuition: the Nim sum introduces XOR, a fundamental operation in computer science.
  • Planning: the best immediate removal and the move that wins later are often different.
  • Decision-making: every turn has clear consequences and no result depends on luck.

Frequently Asked Questions

Is Apple Nim free?

Yes. The game is completely free and runs in your browser without registration or a download.

Is there a guaranteed winning strategy?

Yes. Nim is a solved mathematical game. Whether the player to move can force a win depends on the current row sizes and correct play.

What is the Nim sum?

It is the bitwise XOR of the row sizes. In most positions, leaving a Nim sum of zero gives the opponent a losing position.

Why does taking the last apple lose?

This is misère Nim, the variation in which taking the final object loses. Its endgame rule differs from normal Nim.

Can I win without doing binary arithmetic?

Yes. Watch the parity of one-apple rows near the end and learn a few recurring balanced positions through play.

What should I do when two rows remain?

When two equal rows remain, mirroring the opponent’s move in the other row is often the useful pattern, but the last-apple rule still matters.

How many apples may I take?

You must take at least one apple and may take any number from one row, including the entire row.

Who can play?

Anyone who can count can play. The rules suit children, while the strategy offers adults a compact introduction to game theory.

Ready to Challenge the Algorithm?

Choose who moves first and try to leave the poison apple to the computer.

▶ Start Game

Browse all brain games or try the free IQ test.