Skip to content
All work

AI systems

Chronicles

A text game where code rolls the dice, not the model

TypeScriptpnpm monorepoAnthropic APIДетерминированное ядроVitest
500
stubbed runs
≈$0.24
cost per run
46
tests

Problem

Let an LLM decide whether the player's action succeeded and it will bend the outcome toward the prettier scene. The sense of an honest roll — the only thing separating this from AI Dungeon — evaporates in the first twenty minutes.

System

Before the roll the model names the relevant skill and a difficulty; after the roll it narrates an outcome already decided. All the math — the roll, resources, death, card selection — lives in a deterministic engine with zero dependencies and zero API calls. Difficulty is derived in two steps: real-world plausibility on an anchored scale, then a correction for the generated world's explicit laws. Every option must carry a difficulty rationale — the validator rejects options without one.

Role

Solo build: engine, LLM layer, simulation harness.

Outcome

The engine is debugged without a single billed call: 500 stubbed runs caught four balance defects, including one where succeeding at checks made a skilled player die sooner than a random one. That defect only shows up when two strategies are compared — so the comparison is pinned by a test. 46 tests; a run costs ≈$0.24 against a $0.28 budget.