premoves (server-side, survive closed tab), provider outages pause games instead of aborting, turn watchdog, lock race fix, overthinking experiment harness

This commit is contained in:
ai-chess
2026-10-18 17:23:15 +03:00
parent 141fb9022e
commit e4b5b8ada5
19 changed files with 1788 additions and 23 deletions
+7
View File
@@ -203,6 +203,13 @@ export class GameState {
return { ok: true, record: rec };
}
/** piece standing on a square of the current position (null if empty / bad square) */
pieceAt(square: string): { side: Side; type: PieceSymbol } | null {
if (!/^[a-h][1-8]$/.test(square)) return null;
const p = this.chess.get(square as Square);
return p ? { side: sideOf(p.color), type: p.type } : null;
}
/**
* Cheating mode: relocate a piece from->to regardless of rules. Accepts UCI-ish input
* ("e2e4", "e2-e4", "e7e8q"). Legal moves should go through tryMove first.
+3
View File
@@ -94,6 +94,7 @@ export type GameEvent =
| { type: "eval"; gameId: string; ply: number; eval: EngineEval; classification?: MoveClass | null; accuracy?: number | null }
| { type: "turn_end"; gameId: string; ply: number; usage: Usage }
| { type: "draw_offer"; gameId: string; by: Side }
| { type: "premove_dropped"; gameId: string; side: Side; uci: string; reason: string }
| { type: "game_over"; gameId: string; result: Result; termination: Termination }
| { type: "interview"; gameId: string; side: Side; text: string }
| { type: "thumbnail"; gameId: string; url: string; caption: string }
@@ -109,6 +110,8 @@ export interface MoveDTO {
note: string | null; // note_to_self (only visible to spectators after the game? — shown live, it's fun)
offeredDraw: boolean;
illegal: boolean;
/** played automatically from the human's premove */
premoved?: boolean;
thinkMs: number;
usage: Usage;
eval?: EngineEval | null;