Root cause of "why CH-style endless pacing failed": our numbers are float64 (max ~1e308), but CH's endless curve reaches 1e25409+ via a 336-line BigValue class (mantissa * 10^exponent). Without it, exponential growth overflows. Ported CH big_value.gd's game-growth core to Python + GDScript: - normalize, plus/minus/times/scale/divided_by, power, pow_int, square_root, compare, floored/ceiled/rounded, to_float, encoded/from_text (save). - Exact CH constants (LN10, FLOOR_BIAS, 10000-divide threshold, normalize window). - GDScript uses self-preload (no class_name) to avoid duplicate-name conflict. - BIGVALUE_PARITY_PASS 9 cases py==gd; BIGVALUE_PASS 4 checks prove 1e600 and 1.55^100000 (exponent ~18000) representable -- far beyond float64. This is the technical foundation. With BigValue, the CH endless curve (1.55^zone, per-25-level x4 DPS, rebuild souls) can finally be implemented without overflow. Full P2_CHECKS_PASS 98 gates, identity preserved. Owner gates (human feel/device/release) remain open. prototype/ untracked.
55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Proof: BigValue represents numbers far beyond float64 (the endless-game base)."""
|
|
import sys
|
|
sys.path.insert(0, __import__("pathlib").Path(__file__).parent)
|
|
from big_value import BigValue as B, validate
|
|
|
|
|
|
def check(c, m):
|
|
if not c:
|
|
raise AssertionError(m)
|
|
|
|
|
|
def test_core():
|
|
check(not validate(), "core ops valid")
|
|
|
|
|
|
def test_beyond_float64():
|
|
# 1e300 * 1e300 = 1e600 -- float64 overflows, BigValue does not.
|
|
v = B(1.0, 300.0).times(B(1.0, 300.0))
|
|
check(v.exponent == 600.0 and v.mantissa == 1.0, "1e600 representable: " + str(v))
|
|
# CH zone 200000 HP is ~1e25409; zone 1e6 would overflow float64 entirely.
|
|
hp = B.power(1.55, 100000)
|
|
check(hp.exponent > 18000, f"1.55^100000 exponent ~{hp.exponent:.0f}")
|
|
|
|
|
|
def test_endless_growth_no_overflow():
|
|
# Simulate endless exponential HP and DPS that would both overflow float64.
|
|
hp = B(10.0)
|
|
for _ in range(50):
|
|
hp = hp.times(B.power(1.55, 100)) # each step x1.55^100 ~ 1e19
|
|
check(hp.exponent > 900, "endless HP exponent beyond float64: " + str(hp))
|
|
dps = B(8.0)
|
|
for _ in range(50):
|
|
dps = dps.times(B.power(1.55, 100))
|
|
ratio = hp.divided_by(dps)
|
|
check(ratio.mantissa > 0, "endless HP/DPS division works beyond float64")
|
|
|
|
|
|
def test_save_roundtrip():
|
|
for v in (B(1.0), B.power(1.55, 500), B(1.5, 20000), B(1.0, -5000)):
|
|
rt = B.from_text(v.encoded())
|
|
check(v.compare(rt) == 0, f"round-trip {v} -> {rt}")
|
|
|
|
|
|
def main():
|
|
fns = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
|
|
for fn in fns:
|
|
fn()
|
|
print(f"BIGVALUE_PASS {len(fns)} checks (endless-scale big numbers work)")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|