Download tools/chess_tool.py from LonghaoWang/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/spaces/LonghaoWang/Final_Assignment_Template/resolve/main/tools/chess_tool.py
- Command line
-
hf download hf://spaces/LonghaoWang/Final_Assignment_Template/tools/chess_tool.py
-
curl -L -o chess_tool.py https://huggingface.co/spaces/LonghaoWang/Final_Assignment_Template/resolve/main/tools/chess_tool.py
605 Bytes
| """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" | |