Fix an inescapable debt trap the playtest logs exposed
A 182-turn session spent 30% of its turns below zero, went negative on turn 18 and never recovered, and chose the same hard-times option — "take every shift going" — thirty-seven times. The cause was a tuning change made without re-deriving what it meant. Rent went from 385 to 455 while chasing a different problem, which took the mailroom baseline from the designed -$3/day to -$13/day. Worse, at the debt that run accumulated the weekly service charge came to $180 against an escape option worth $120. The hole was inescapable by arithmetic, whatever the player did. Nothing caught it. Every archetype either optimised money or got promoted out of the problem before it bit, and the dominance test passed because rent_bounced was only 17% of turns. Fixes: mailroom wages 980 -> 1120, restoring the -$3/day baseline; the escape option 120 -> 220, so it is worth more than a week's rent; rent_bounced from weight 5000 with no cooldown to 900 on a cooldown of 3, because being broke should colour a run rather than replace it; debt_collector from weight 25 to 45, since at 25 it appeared six times in 262 turns and debt became a ratchet. Three guards so this class of bug cannot recur quietly. The baseline is now asserted directly: a test sums the pack's own upkeep over twenty fortnights and requires the mailroom to net between -90 and +10, and Dispatch to be better but not so much better that money stops mattering. That would have failed the moment rent changed. Outcome tests over simulated play are a slow and noisy way to detect a number that is simply wrong. A `lifer` archetype refuses any option that would change stage — generically, by looking for an effect on `stage` — and otherwise plays for people. It reproduces the session that found this; no other archetype can. And no archetype may spend more than a quarter of a run below zero. Hard times is a state a player passes through; living in it is the failure mode. Also fixed: the analyser reported "every ~-5 turns". One export can hold several playthroughs and turn numbers restart with each, so spans are now accumulated per run and pooled rather than measured across the seam between two. 121 tests. Reasoning in docs/DECISIONS.md §29-30. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMSFHyVPitUoosW5wyEADj
This commit is contained in:
co-authored by
Claude Opus 5
parent
76072edf4e
commit
5c1784d990
+37
-12
@@ -54,18 +54,42 @@ function byRun(entries) {
|
||||
return runs;
|
||||
}
|
||||
|
||||
function reportRepetition(entries) {
|
||||
/**
|
||||
* How often each situation came round.
|
||||
*
|
||||
* Gaps are pooled *within* runs and never across them. An export can hold
|
||||
* several playthroughs, and turn numbers restart with each — measuring a gap
|
||||
* across that seam produced "every ~-5 turns", which is how this was caught.
|
||||
*/
|
||||
function reportRepetition(runs) {
|
||||
const counts = new Map();
|
||||
const firstSeen = new Map();
|
||||
const lastSeen = new Map();
|
||||
for (const entry of entries) {
|
||||
counts.set(entry.event_id, (counts.get(entry.event_id) ?? 0) + 1);
|
||||
if (!firstSeen.has(entry.event_id)) firstSeen.set(entry.event_id, entry.turn);
|
||||
lastSeen.set(entry.event_id, entry.turn);
|
||||
const spans = new Map(); // summed (last - first) within each run
|
||||
const pairs = new Map(); // summed (appearances - 1) within each run
|
||||
const onlyTurn = new Map();
|
||||
let turns = 0;
|
||||
|
||||
for (const run of runs.values()) {
|
||||
const firstSeen = new Map();
|
||||
const lastSeen = new Map();
|
||||
const inRun = new Map();
|
||||
for (const entry of run) {
|
||||
turns++;
|
||||
counts.set(entry.event_id, (counts.get(entry.event_id) ?? 0) + 1);
|
||||
inRun.set(entry.event_id, (inRun.get(entry.event_id) ?? 0) + 1);
|
||||
if (!firstSeen.has(entry.event_id)) firstSeen.set(entry.event_id, entry.turn);
|
||||
lastSeen.set(entry.event_id, entry.turn);
|
||||
}
|
||||
for (const [eventId, appearances] of inRun) {
|
||||
if (appearances > 1) {
|
||||
spans.set(eventId, (spans.get(eventId) ?? 0) + (lastSeen.get(eventId) - firstSeen.get(eventId)));
|
||||
pairs.set(eventId, (pairs.get(eventId) ?? 0) + (appearances - 1));
|
||||
} else if (!onlyTurn.has(eventId)) {
|
||||
onlyTurn.set(eventId, firstSeen.get(eventId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const distinct = counts.size;
|
||||
const turns = entries.length;
|
||||
section('Repetition');
|
||||
console.log(`${turns} turns across ${distinct} distinct situations ` +
|
||||
`— each seen ${(turns / distinct).toFixed(1)} times on average.`);
|
||||
@@ -77,9 +101,10 @@ function reportRepetition(entries) {
|
||||
const most = ranked[0][1];
|
||||
console.log('');
|
||||
for (const [eventId, count] of ranked) {
|
||||
const gap = count > 1
|
||||
? ` every ~${Math.round((lastSeen.get(eventId) - firstSeen.get(eventId)) / (count - 1))} turns`
|
||||
: ` once, turn ${firstSeen.get(eventId)}`;
|
||||
const pairCount = pairs.get(eventId) ?? 0;
|
||||
const gap = pairCount > 0
|
||||
? ` every ~${Math.max(1, Math.round(spans.get(eventId) / pairCount))} turns`
|
||||
: ` once${runs.size > 1 ? ' per run' : `, turn ${onlyTurn.get(eventId)}`}`;
|
||||
console.log(` ${eventId.padEnd(24)} ${String(count).padStart(3)} ` +
|
||||
`${bar(count / most)} ${pct(count, turns).padStart(6)}${gap}`);
|
||||
}
|
||||
@@ -193,7 +218,7 @@ async function main() {
|
||||
console.log(` seed ${seed}: ${run.length} turns, ${stages.join(' → ')}`);
|
||||
}
|
||||
|
||||
reportRepetition(entries);
|
||||
reportRepetition(runs);
|
||||
reportChoices(entries);
|
||||
reportGates(entries);
|
||||
reportFeedback(entries);
|
||||
|
||||
Reference in New Issue
Block a user