Files
uconsole_asw_game/tests/test_decoy_speed_units.py
T
Claude 7f5f2a523a Fix review findings: web observer, key leaks, sub drift, dead code, help texts (1.3.173)
- Remote Crew: observer admin action allowed, direct fire for U-boat weapons,
  U-boat station help texts and manual links, select controls not rebuilt
- Keys: Shift+A / Ctrl+R at Weapons never fire, Shift+A on the U-boat never
  toggles silent running
- Simulation: lurking submarine steers into the current, decoy speed units
  in the sonar Doppler term
- Remove dead functions, constants and imports found by the audit
- Help and catalog wording (Submarine/U-Boot, German grammar), shortcut sheets

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CW6FkwLLc6KvPHvCs5KTRo
2026-10-03 07:10:08 +00:00

17 lines
600 B
Python

"""A decoy keeps its speed in NM/s; sonar must read its knots."""
import random
from types import SimpleNamespace
from src.enemies.decoy import Decoy
from src.sonar import sonar
def test_decoy_doppler_uses_knots_not_nm_per_second():
decoy = Decoy(10.0, 10.0, 50.0, random.Random(4))
decoy.course = 0.0 # running north, at the observer
observer = SimpleNamespace(x=10.0, y=5.0, course=0.0, speed=0.0)
expected = 1.0 + decoy.speed_kn / sonar.SOUND_SPEED_KN
assert decoy.speed_kn > 1.0
assert abs(sonar.doppler_factor(decoy, observer) - expected) < 1e-9