From 139601b1079f24ef64c6b0f7726bf235d62488ea Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sat, 8 Aug 2026 22:49:44 +0200 Subject: [PATCH] OCR: support the opening calibration order's plain-prose target line 'Target is at- Q4 4:2' (no #id, unlike the usual block shape) is how the game's very first order gives the target. Store it as a fixed (UNKNOWN, "1") entry since there's only ever one. --- src/fenigma/ocr.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fenigma/ocr.py b/src/fenigma/ocr.py index 10b5049..ab9e1bd 100644 --- a/src/fenigma/ocr.py +++ b/src/fenigma/ocr.py @@ -54,6 +54,7 @@ def ocr_text(image: Image.Image) -> str: NEST_KEYWORD = "IRON NEST" SPOTTER_KEYWORD = "SPOTTER" +TARGET_IS_AT_KEYWORD = "Target is at" _FUZZY_THRESHOLD = 0.65 @@ -446,6 +447,16 @@ def parse_text(text: str) -> ParsedInfo: if spotter_id is not None and coord is not None: info.spotters[spotter_id] = coord + # The game's opening calibration order gives the target as plain + # prose ("Target is at- Q4 4:2") rather than the usual "Target#N:" + # block shape, there's only ever one of these, so it's stored under + # a fixed id ("1") rather than one parsed from the text. + if (TargetType.UNKNOWN, "1") not in info.targets and _fuzzy_contains(line, TARGET_IS_AT_KEYWORD): + coord = _extract_coord(line) + if coord is not None: + info.targets[(TargetType.UNKNOWN, "1")] = (line, [], coord) + continue + for entry in parse_intel_blocks(text): if entry["kind"] == "rp": info.reference_points[entry["name"]] = (entry["raw"], entry["clues"], entry["coord"])