3 Commits

Author SHA1 Message Date
seppedl 2e97bb1a29 Add save/load game with named save files
Serialize full game state (objects, flags, containment, clocks) to
JSON files in ~/.h2g2_saves/. Players can name saves, list existing
ones, and restore by name or number.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:56:03 +02:00
seppedl 91a02fda8e Add up/down arrow command history to game input
Replace bare input() with a custom terminal reader that supports
arrow-key history navigation, cursor movement, and line editing.
History buffer grows dynamically with no fixed limit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:55:55 +02:00
seppedl 679639df9f Wire game transitions end-to-end, add Guide lookup, add 79 tests
Transitions:
- Add I-HOUSEWRECK (tick 20) and I-VOGONS (tick 50) timed events to
  earth.py, queued at startup in main.py
- I-VOGONS demolishes Earth and moves player to Vogon Hold
- Fix airlock→Dark transition to call Dark room M-ENTER handler
- Fix dream-restore to support multiple callbacks (list instead of single)
- Add state.finish() call to RAMP for endgame victory

Guide system:
- Add 16-entry lookup database to GUIDE object (space, towel, vogons,
  poetry, beast, babel fish, earth, magrathea, marvin, etc.)
- "consult guide about X" now returns relevant entry text

Tests (79 passing):
- test_engine.py (14): containment, flags, articles, clock mechanics
- test_parser.py (20): directions, compound verbs, prepositions, synonyms
- test_earth.py (21): full opening sequence, puzzles, navigation
- test_vogon.py (4): room existence, Hold first-visit sequence
- test_dark.py (7): inventory clearing, dream dispatch, probabilities
- conftest.py: shared game fixture and send() helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:04:22 +02:00