Backward Reasoning Game Solver
by @quochungto
Solve sequential-move strategic games using backward induction. Use this skill when a user faces a multi-stage decision or negotiation where players alternat...
Example 1: The 21-Flags Game (Survivor: Thailand)
Setup: 21 flags; players alternate; each turn take 1, 2, or 3; player who takes the last flag(s) wins.
Apply k+1 formula (k=3, so k+1=4):
Full contingent strategy for first player: Take 1. Whatever opponent takes (n), take 4-n. After your turn the count is always a multiple of 4. Opponent is trapped.
Why Sook Jai lost: They took 2 on the opening move, leaving 19 β not a multiple of 4. This handed the initiative to Chuay Gahn. The tribe needed to reason all the way back to the opening move; recognizing the 4-flag trap mid-game is too late.
Example 2: The Fredo Investment Game
Setup: Charlie considers investing $100K with Fredo. If Charlie invests, Fredo can honor the contract (Charlie nets $150K, Fredo nets $250K) or abscond (Charlie loses $100K, Fredo keeps $500K). If Charlie does not invest, both get $0.
Game tree:
Charlie
βββ Invest β Fredo
β βββ Abscond β [Charlie: -$100K, Fredo: +$500K]
β βββ Honor β [Charlie: +$150K, Fredo: +$250K]
βββ Don't β [Charlie: $0, Fredo: $0]
Backward induction at Fredo's node: Fredo prefers $500K over $250K β will Abscond.
Fold back: If Charlie invests, realized outcome is [Charlie: -$100K]. Compare to Don't: [Charlie: $0]. Charlie prefers $0 β Don't invest.
Equilibrium: No investment; both get $0. The mutually beneficial outcome ($150K/$250K) is blocked by the inability to commit credibly.
Caveat: This changes if the game is repeated or if Fredo has other US-dependent business interests β these create an ongoing game with reputation effects that can sustain cooperation.
Example 3: The Orange Bowl Risk Sequencing
Setup: Nebraska needs 2 extra points net across two touchdowns. Option A: two-point conversion attempt (~50% success). Option B: one-point kick (~95% success). Osborne's order: B then A. Alternative: A then B.
Backward induction on Osborne's order (B first):
Backward induction on alternative order (A first):
Key insight: The only scenario where order matters is when exactly one attempt fails. If A fails first, the fallback (B on the second touchdown) still yields a tie. If B fails first (Osborne's plan), the second touchdown forces a must-make two-pointer with no margin. Attempt the risky action first.
clawhub install bookforge-backward-reasoning-game-solver