mirror of
https://github.com/db9979/uconsole_asw_game.git
synced 2026-12-06 21:04:18 +01:00
- Bump the save format to v12 (u-jagd-save-v12); every v11 save is rejected without migration. Remove the same-version v10/v11 upgrader chain, the legacy ESM v1/v2 and two-channel ECM restore paths. - Declare exact save key sets in src/core/save_schema.py. - Persist Sub._active_ping_cd and SurfaceShip torpedo-evasion state, which were silently reset on load and broke deterministic continuation. - Validate the damage block exactly (keys, teams, bounded flood/fire). - Add a simulated own-ship AIS receiver (ITU-R M.1371 class-A cadence, VHF line of sight). Radar observations of civilians no longer carry the true name and course (observation-boundary leak). - Add src/core/detrand.py for stateless deterministic draws. - Add tools/calibrate.py with golden 1.0.0 gameplay metrics and a test that keeps later physics phases within tolerance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""Physics upgrades must keep the recorded 1.0.0 gameplay calibration."""
|
|
|
|
import importlib.util
|
|
import json
|
|
import os
|
|
|
|
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
def _tool():
|
|
spec = importlib.util.spec_from_file_location(
|
|
"calibrate", os.path.join(ROOT, "tools", "calibrate.py"))
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def test_golden_calibration_holds_within_tolerance():
|
|
tool = _tool()
|
|
golden = tool.load_json(tool.GOLDEN_PATH, None)
|
|
assert golden is not None and golden["metrics"]
|
|
problems = tool.compare(tool.measure_all(), golden,
|
|
tool.load_json(tool.DEVIATIONS_PATH, {}))
|
|
assert problems == []
|
|
|
|
|
|
def test_every_deviation_is_justified_and_known():
|
|
tool = _tool()
|
|
golden = tool.load_json(tool.GOLDEN_PATH, None)
|
|
with open(tool.DEVIATIONS_PATH, encoding="utf-8") as handle:
|
|
deviations = json.load(handle)
|
|
for key, entry in deviations.items():
|
|
assert key in golden["metrics"], key
|
|
assert isinstance(entry.get("reason"), str) and len(entry["reason"]) > 20
|
|
assert set(entry) <= {"reason", "value", "tolerance", "phase"}
|