Chess — Rules & timers
Game mechanics, clock behaviour, reconnect window, and all possible game:over reasons.
Clock
Each player starts with 10 minutes (600 000 ms). The clock counts down only while it's that player's turn. When a player's clock hits zero, game:over fires with reason: "timeout".
Clock values are sent in every game:move:made and timer:update event as playerTimers: { [playerId]: number } (milliseconds remaining). The Timer component syncs automatically.
Reconnect
When a player disconnects, the server starts a 60-second window. The opponent receives player:disconnected. If the player reconnects within 60 seconds by emitting game:reconnect { playerId }, the game resumes and both players receive game:reconnected. If the window expires, game:over fires with reason: "disconnect".
Pawn promotion
When a pawn reaches rank 8 (white) or rank 1 (black), include promotion in the move payload. The ChessBoard component shows a dialog automatically — if you're handling moves manually, pass the promotion piece.
| Value | Piece |
|---|---|
q | Queen (most common) |
r | Rook |
b | Bishop |
n | Knight |
Draw conditions
Bot difficulty
| Difficulty | Response delay | Strength |
|---|---|---|
easy | 0.5–1.5s | Makes occasional blunders. Good for beginners. |
medium | 1–3s | Plays solid moves. Misses complex tactics. |
hard | 2–5s | Strong play. Rarely blunders. |
game:over — reason reference
| reason | winner | Triggered by |
|---|---|---|
checkmate | playerId | King is in checkmate — no legal moves to escape. |
resignation | playerId | Player emitted game:resign. |
timeout | playerId | Player's 10-minute clock reached 0. |
afk_timeout | playerId | Player was idle for 90 seconds. |
stalemate | null | No legal moves, not in check. |
draw | null | Insufficient material, threefold repetition, or 50-move rule. |
draw by agreement | null | Both players agreed via game:draw:offer / game:draw:accept. |
disconnect | playerId | Opponent did not reconnect within 60 seconds. |