🎮 Beta Gamer

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

FieldValuesDescription
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

DifficultyResponse delayStrength
easy0.5–1.5sMakes occasional blunders. Good for beginners.
medium1–3sPlays solid moves. Misses complex multi-jump chains.
hard2–5sStrong play. Rarely misses captures.

game:over — reason reference

reasonwinnerTriggered by
victoryplayerIdOpponent has no pieces remaining or no legal moves.
resignationplayerIdPlayer emitted game:resign.
afk_timeoutplayerIdPlayer was idle for 90 seconds.
drawnullNo captures are possible for either side — the game cannot progress.
disconnectplayerIdOpponent did not reconnect within 60 seconds.
Beta Gamer GaaS API — questions? support@beta-gamer.com