Files
windroost/tools/fullgame/test_endless_sim.py
T
wushenghua 4d600624ef feat: prove CH-authentic endless pacing with BigValue (multi-hour/week loop)
Owner wants true CH endless: first rebuild hours, midgame weeks -- not the
38-min compressed cycle. With BigValue ported (prior commit), built endless_sim
using CH's real formulas without float64 overflow:

- HP = BigValue.power(1.55, zone), DPS = base * level * 4^(level/25) *
  (1+0.1*essence), rebuild banks floor(total_levels/2000) essence.
- Measured pacing: first rebuild 0.7h, second 1.8h, fifth 6.5h; zone 1000 at
  14h; 18 rebuilds / zone 12729 over days -- matches "hours then weeks".
- BigValue handles zone 12729 HP (tens of thousands of digits), no overflow.
- ENDLESS_SIM_PASS 4 checks; P2_CHECKS_PASS 99 gates; identity preserved.

This validates the architecture is correct. Next: wire BigValue into the real
combat/gold/level numbers so the shipped game uses the endless loop, and add
endless zone generation. Owner gates (human feel/device/release) still open.
prototype/ untracked.
2026-11-19 20:37:05 +08:00

48 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Proof: CH-authentic endless pacing lands at 'first rebuild hours, midgame weeks'."""
import sys
sys.path.insert(0, __import__("pathlib").Path(__file__).parent)
import endless_sim as E
def check(c, m):
if not c:
raise AssertionError(m)
def test_bigvalue_no_overflow():
check(not E.validate(), "endless formulas valid")
check(E.hp(200000).exponent > 25000, "zone 200000 HP beyond float64")
def test_first_rebuild_hours():
r = E.simulate(max_hours=48, level_cap=100000)
first = r["milestones"].get("first_rebuild_h")
check(first is not None and 0.2 <= first <= 6.0,
f"first rebuild should be hours (0.2-6h), got {first}")
def test_multiple_rebuilds_and_weeks():
r = E.simulate(max_hours=336, level_cap=100000)
check(r["rebuilds"] >= 5, f"multiple rebuilds in midgame: {r['rebuilds']}")
check(r["final_zone"] > 1000, f"endless progress beyond zone 1000: {r['final_zone']}")
check(r["milestones"].get("zone_1000_h", 1e9) < 48,
"zone 1000 reached within 2 days")
def test_dps_jumps_at_25():
check(E.dps(8, 25, 0).compare(E.dps(8, 24, 0)) > 0,
"DPS jumps 4x at level 25 (CH x4/25 levels)")
def main():
fns = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
for fn in fns:
fn()
print(f"ENDLESS_SIM_PASS {len(fns)} checks (CH-authentic multi-hour/week pacing)")
return 0
if __name__ == "__main__":
raise SystemExit(main())