Checkers — Rules & board
Board layout, game mechanics, reconnect window, and all possible game:over reasons.
Board layout
The board is a flat array of 64 elements (indices 0–63, row-major, top-left to bottom-right). Only dark squares — where (row + col) % 2 !== 0 — can hold pieces. Light squares are always null.
type Piece = { player: 'red' | 'black'; type: 'man' | 'king' } | null;
type Board = Piece[]; // length 64
// Index formula: index = row * 8 + col
// Row 0 is the top of the board (black's back rank)
// Row 7 is the bottom (red's back rank)
// Starting positions:
// Black: rows 0–2 (indices 0–23, dark squares only)
// Red: rows 5–7 (indices 40–63, dark squares only)
// Example: check what's at row 5, col 1
const piece = board[5 * 8 + 1];
// → { player: 'red', type: 'man' }
// Check if a square is playable (dark)
const isPlayable = (row: number, col: number) => (row + col) % 2 !== 0;Piece type
| Field | Values | Description |
|---|---|---|
player | "red" | "black" | Which player owns this piece. |
type | "man" | "king" | "man" moves forward only. "king" moves in all four diagonal directions and can capture backwards. |
Game mechanics
🔴 Turn order: Red always moves first. Color is assigned in game:started.
⚡ Mandatory captures: If any capture move is available, you must capture. game:valid_moves only returns capture moves when captures exist — if moves[].captures is non-empty for any move, all returned moves are captures.
🔗 Multi-jump: A piece that captures can continue jumping in the same turn if further captures are available. The entire chain is submitted as a single game:move with all jumped indices in captures[].
👑 Promotion: A man reaching the opponent's back rank (row 0 for red, row 7 for black) is promoted to king. game:move:made includes becameKing: true. Kings move and capture in all four diagonal directions.
🔄 Reconnect: 60-second window after disconnect. Opponent sees a "disconnected" banner. Game resumes on reconnect via game:reconnect { playerId }.
🏳 Resign: Emit game:resign { roomId, playerId }. Opponent wins immediately with reason: "resignation".
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 multi-jump chains. |
hard | 2–5s | Strong play. Rarely misses captures. |
game:over — reason reference
| reason | winner | Triggered by |
|---|---|---|
victory | playerId | Opponent has no pieces remaining or no legal moves. |
resignation | playerId | Player emitted game:resign. |
afk_timeout | playerId | Player was idle for 90 seconds. |
draw | null | No captures are possible for either side — the game cannot progress. |
disconnect | playerId | Opponent did not reconnect within 60 seconds. |
Beta Gamer GaaS API — questions? support@beta-gamer.com