testsAndMisc/docs/superpowers/contracts/kcd2-balatro-single-joker-face-2026-07-25.json
Krzysztof kuhy Rudnicki 4aae92ae09 kcd2_dice_solver: Balatro's die has one joker face, not six
The wiki's dice-effect row for Balatro's die is `{{Dice effect|d|d|d|d|d|d}}`
— six *unfilled placeholder* cells that render as "d%". A previous pass read
those six `d`s as six wildcard faces, which made the die resolve every throw in
the player's favour: EV 8000, bust 0%, and the solver forced it into every
loadout it could. Only one face is the joker (Jimbo's grinning face, visible on
the item icon), and no source publishes the die's side weights at all.

The two joker faces also do not score alike, and the scorer was treating them as
one thing. Per the wiki, a Devil's head "matches any combination but never
scores on its own", while Balatro's joker counts as a 1 when picked alone. So
there are now two substitute slots: a Devil's head is spent inside the
combination it completes rather than resolved to a plain face, which is what
stops it being held as a lone 1. Hands with no substitute keep the original
single-pass code path.

Balatro's die: EV 8000 -> 771.2, bust 0% -> 3.09%; a lone devil's head scores
100 -> 0 and is no longer a legal hold. The two dice now tie exactly on a single
throw of six and differ only mid-turn (813.7 vs 808.3 points per turn), which is
where "may be held alone" actually pays.

Which pip the joker replaces is unpublished; the 1 is assumed, matching the
Devil's head die the game compares it to, and marked UNVERIFIED in the data.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 16:14:04 +02:00

22 lines
3.4 KiB
JSON

{
"title": "Balatro's die has one joker face, not six",
"objective": "The KCD2 dice solver modelled Balatro's die as having all six faces wild, because the wiki's dice-effect row for that die is `{{Dice effect|d|d|d|d|d|d}}` — six unfilled placeholder cells rendering as \"d%\" — and a previous pass read those six `d`s as six wildcards. The die therefore resolved every throw in the player's favour (EV 8000, bust 0%) and the solver forced it into any loadout that could hold it. Correct the die to a single joker face, and while there, stop treating the game's two joker faces as one thing: a Devil's head 'matches any combination but never scores on its own' whereas Balatro's joker 'counts as if you threw 1' when picked alone. Success means the solver values Balatro's die like the fair die it is, and neither joker gets a scoring right the wiki denies it.",
"acceptance_criteria": [
"Balatro's die carries exactly one wildcard face and no invented percentages: weights stay uniform with a comment stating that no source publishes its side weights, so the literal cannot be mistaken for a transcribed wiki figure.",
"categoryWeights routes Balatro's joker to a score-alone substitute slot and the Devil's head to a combination-only slot, with 1/6 on the joker and 1/6 on each of the five remaining printed faces.",
"A lone Devil's head scores 0 and is not a legal hold (scoreUsingAll returns -Infinity); a lone Balatro joker scores 100 and is a legal hold.",
"Both substitutes still fill in for any face of a straight, a triple, or an n-of-a-kind extension, matching every example the wiki gives.",
"The solver no longer prefers Balatro's die unconditionally: on an inventory holding both Balatro and Weighted dice it takes the Weighted set.",
"The test that asserted 'routes every Balatro face into the wildcard slot' is rewritten to assert the corrected distribution, not merely retitled — it is the test that should have caught this.",
"vitest run --coverage keeps 100% statement, branch, function and line coverage with no new suppressions, and tsc --noEmit, eslint src and pnpm build are clean.",
"README.md and the in-app caveat list state the remaining assumptions (uniform weights, joker-replaces-1, all-substitute combinations) instead of claiming the die always wins."
],
"out_of_scope": [
"Any other die's published percentages — no other row in src/data/dice.ts is touched.",
"Verifying in-game which pip the joker replaces; the 1 is assumed (matching the Devil's head die the game compares it to) and marked UNVERIFIED in the data.",
"UI restyling. DieRow keeps graphing the printed-face distribution, so both joker dice still show a bar for the face their joker replaces, exactly as the Devil's head always has.",
"The 12 pre-existing pytest failures in the untracked python_pkg/session_autopsy package, which this change (TypeScript and markdown only) neither causes nor fixes."
],
"verifier": "node_modules/.bin/vitest run --coverage (222 tests, 100% branch coverage); node_modules/.bin/tsc --noEmit; node_modules/.bin/eslint src; pnpm build; pre-commit run --files <staged>; plus a real solver run before and after the change (scratchpad demo bundled with esbuild) showing Balatro's EV 8000.0 -> 771.2, lone devil's head 100 -> 0, devil-alone hold legal -> -Infinity, and the solver switching from a forced Balatro pick to 6x Weighted."
}