Spielerando

My stockpile shows minus 3 wood and I cannot tell who spent it

A stockpile that dips below zero is a bug, but the guilty spender is rarely the one your AI blames first. This entry gives your AI a ledger reader that replays the numbers fairly and names the exact entry that crossed the line.

Why this works

Within one tick, income and spending have no real order, so blaming whoever is listed first is arbitrary. A fixed rule, income first and then spending in file order, makes the culprit repeatable and matches how most games settle a tick.

When not to use it

Skip it when your game does not keep a ledger at all. Then first add a line per change (tick, resource, amount, who) before you try to debug anything else.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • A diagram of every state
  • 38 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "My stockpile shows minus 3 wood and I cannot tell who spent it" (read_entry strategy-stock-went-negative-who-spent) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP