Dawn at the guild hall. The heroes nurse their ale, and the board is pinned full of contracts. You are the guildmaster: who rides for what is your call — and every contract pays differently for might ⚔, lore ✦ and guile ❧.
Run all five days — the bench grows from three heroes to seven — then a real optimizer posts the board back at you.
Five days, five assignment puzzles — here's your ledger next to the proven-best rosters.
Every hero takes exactly one contract, every contract takes exactly one hero, and you want the richest total. That is the Assignment Problem — one of the oldest questions in Operations Research, and the textbook case of why "give everyone their best match" fails: your champion earns the most on the dragon, but her edge over the second-best hero may be tiny there and huge elsewhere.
You've been filling in a matrix all along: heroes as rows, contracts as columns, gold in every cell — pick one cell per row and per column.
Day five had 7 heroes: 5,040 possible rosters (7!), just about checkable by a stubborn guildmaster. At 20 heroes it's 2.4 quintillion; at 60, more rosters than there are atoms in the observable universe. It smells exactly like the hopeless explosions of routing puzzles…
…but this one keeps a secret: it is not hard. The assignment problem was among the first combinatorial monsters to fall — solvable to a guaranteed optimum in polynomial time. The border between "easy once you're clever" and "genuinely hard" runs right between this quest board and a delivery map.
The Hungarian method (Harold Kuhn, 1955 — named in honour of the Hungarian mathematicians Kőnig and Egerváry) never tries rosters. It sets prices: a wage u for every hero, a premium v for every contract, kept high enough that no pairing beats its prices, and hires only along pairs the prices make "tight":
keep u(hero) + v(quest) ≥ gold(hero, quest) for every pair
hire only tight pairs: u + v = gold
stuck? lower prices by the smallest slack, try again
all n hired → Σ gold = Σ u + Σ v → no roster can pay more ∎
That last line is the point: the prices are a certificate (LP duality, for the connoisseurs). The answer doesn't come with a search log — it comes with a proof. Runtime O(n³): a 1,000-hero guild prices out in well under a second.
Your five days were solved live in this tab — plain TypeScript in a Web Worker, microseconds per day, every reveal a fresh proof. In daylight the same maths assigns service technicians to the day's jobs, crews to flights, drivers to vehicles, machines to orders — and with the same matching core, students to schools and kidney donors to patients (the matching markets behind a 2012 Nobel prize).
Wherever "who does what" is decided by gut feeling, an assignment model usually finds the gold left on the table.
Use case: workforce assignment ▸ Follow me for more games ▸