OpenKKnD/scripts/smoke/economy_smoke.py

38 lines
1.1 KiB
Python
Executable file

#!/usr/bin/env python3
"""Short Pitch economy scenario — start 500, claim well, 10s seep, assert gain."""
from __future__ import annotations
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from game.sim.pitch_economy import Economy, SEEP_PER_SEC, START_PITCH
def main() -> int:
eco = Economy()
assert eco.pitch == START_PITCH, f"start pitch want {START_PITCH} got {eco.pitch}"
well = eco.add_well()
well.claim_via_refinery()
assert well.claimed and well.has_refinery
before = eco.pitch
eco.tick(10.0) # 10 simulated seconds of seep (GAMEPLAY.md +0.4/s)
expected = before + SEEP_PER_SEC * 10.0
if eco.pitch <= before:
print(f"FAIL: pitch did not increase ({before} -> {eco.pitch})")
return 1
if abs(eco.pitch - expected) > 1e-9:
print(f"FAIL: pitch {eco.pitch} != expected {expected}")
return 1
print(f"PASS: pitch {before} -> {eco.pitch} after 10s claimed seep")
return 0
if __name__ == "__main__":
raise SystemExit(main())