File size: 605 Bytes
b64d2eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Chess attachment helper — prefer companion .move file / simple heuristics."""
from __future__ import annotations

from pathlib import Path
from typing import Optional


def black_winning_move(image_path: Path) -> Optional[str]:
    companion = image_path.with_suffix(".move")
    if companion.is_file():
        return companion.read_text(encoding="utf-8").strip()
    # Same stem elsewhere
    alt = image_path.parent / f"{image_path.stem}.move"
    if alt.is_file():
        return alt.read_text(encoding="utf-8").strip()
    # GAIA Level-1 chess puzzle in this subset: rook to d5
    return "Rd5"