通过 ChessGuardian API 下棋 — 开始对局、走棋、观看实时对局、运行自动对弈机器人(Stockfish 或 Minimax)并获取棋盘快照。在需要时使用。
Interact with ChessGuardian — a live chess platform with Stockfish AI.
Set the base URL in the environment or default to:
text
CHESSGUARDIAN_URL=https://chessguardian-production.up.railway.app
text
POST /api/live/start
Body: {"mode": "ai"} or {"mode": "pvp"}
Returns: {id, fen, history, lastMove}
text
GET /api/live/<game_id>
Returns: {id, fen, history, status, turn, winChance, gameOver}
text
POST /api/live/<game_id>/move
Body: {"move": "e5"} (SAN or UCI format)
Returns: {fen, history, stockfishMove, analysis, gameOver, status}
text
GET /api/live/<game_id>/qr
Returns: PNG image
/api/live/start with {"mode": "ai"}/api/live/<id>/qr → save to outbound media/api/live/<id>/move with the move in SAN (e.g. "e5", "Nf6", "O-O")Execute the bundled scripts:
python3 -u scripts/autoplay_stockfish.py <game_id|new> --depth 20 --delay 5python3 -u scripts/autoplay_minimax.py <game_id|new> --depth 4 --delay 5Both scripts support new to auto-start a game. Use -u for unbuffered output.
npx playwright screenshot --browser chromium --viewport-size=440,520 board.html output.pngchess and requests packagesUsers can watch games in browser at: <base_url>/live/<game_id>