Add Hammurabi: the 1968/1978 BASIC city-state classic
Add Hammurabi: the 1968/1978 BASIC city-state classic
#1 in Riparion/riparion-retro — merged 2026-06-07
Summary
Third game in the collection: a mobile-first WASM Dioxus port of HAMURABI from BASIC Computer Games (1978), after Doug Dyment's The Sumer Game (1968).
games/hammurabi
- Pure-Rust engine, line-for-line against the 1978 listing: land at 17–26 bushels/acre, 1–5 yield, even-roll rats eating
INT(S/C), the ~20% plague formula (the listing's "15%" comment is wrong), the >45%-starved impeachment, the can't-sell-your-last-acre quirk, surplus feeding skipping the P1 update, and the exact P1/L verdict tiers incl. the middle tier's would-be assassins. One concession: negative-input steward dismissal is replaced by clamping (numeric soft keyboard can't produce it). - Reload-safe paced report scroll: report lines live in the saved log; a revealed counter paces them, so a mid-playback refresh loses nothing.
- Spoiler-free status bar: chips freeze at pre-decision values while a report paces.
- Hardened against corrupt saves:
sanitize()on load plus guarded divisors/saturating bounds. - 27 host tests incl. exact-formula checks, boundary tests, and a 200-seed scripted-term smoke suite.
retro-kit
NumberEntry: optional custompreviewcallback; reactivepromptclears the typed value when the question changes (also fixes latent stale digits in taipan's bank toggle).- New
ScoreBoardcomponent — replaces the third verbatim copy of the hall-of-fame panel (taipan, lunar-lander, hammurabi all migrated).
Tailwind scan fix
Each game's tailwind.css now adds @source "../../crates/retro-kit/src" — the scan only covers the game's own sources, so utilities used solely inside shared retro-kit components were silently dropped from compiled CSS. Scaffold script and NOTES.md updated.
Verification
cargo test85 passing across the workspace;cargo clippy --all-targetszero warnings- Driven in Chromium at 390×844: full-term victory, impeachment, save/resume across reload, chip-freeze during paced reveal, hall-of-rulers recording, release-build smoke
- Post-/code-review (high effort): 5 verified findings, all fixed in this PR
🤖 Generated with Claude Code
Last updated 2026-06-08
Links to this note
Credits
Merged pull requests, newest first.