Tigers & The Sheep

An interactive backward-induction visualization of the Brainstellar strategy puzzle. Change the number of tigers and inspect why the outcome alternates between survival and attack.

Choose the number of tigers

Each tiger wants to survive. If survival is safe, it prefers to eat the sheep.

100
tigers
150100
Outcome
πŸ‘
The sheep survives
100 is even, so no tiger wants to make the first move.
The key backward-induction step

If one tiger attacks, it becomes the new sheep. The state therefore changes from N tigers + 1 sheep to Nβˆ’1 tigers + 1 sheep.

CURRENT STATE 100 🐯 + 1 πŸ‘ sheep survives one tiger attacks attacker β†’ new sheep NEXT STATE 99 🐯 + 1 πŸ‘ new sheep would die
Build the pattern from the base case

Tap a state to inspect why it alternates.

Base case

N = 1 β†’ attack

The only tiger can eat the sheep and nobody remains to eat it afterward.

Recurrence

State(N) depends on State(Nβˆ’1)

A tiger attacks exactly when becoming the sheep in the Nβˆ’1 state is safe.

Result

Even N β†’ sheep survives

Odd N β†’ one tiger attacks. Even N β†’ every tiger is deterred.

For 100 tigers: 100 is even β†’ attacking would leave 99 tigers with the attacker as sheep β†’ that sheep would be eaten β†’ therefore nobody attacks β†’ the original sheep survives.

Source puzzle: Brainstellar β€” Tigers & The Sheep