Documentation
¶
Overview ¶
Package checkers is a pure-Go American checkers (English draughts) rules engine — no protocol, no I/O, standard library only.
Extracted from https://github.com/richardwooding/kibitz
Squares are the 32 dark squares, 0-indexed in PDN order: square 0 is the top-left dark square (Black's back row), row-major. Black sits on rows 0–2 (squares 0–11) and moves DOWN (increasing rows); White sits on rows 5–7 (squares 20–31) and moves up. Black moves first.
Captures are forced: if any jump exists, only jump paths are legal, and a jump continues while the same piece can keep jumping. Promotion mid-path ends the move (a new king may not continue the jump sequence).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrIllegalMove = errors.New("checkers: illegal move")
Functions ¶
Types ¶
type Board ¶
type Board [32]int8
Cell values: 0 empty; +1 black man, +2 black king; -1 white man, -2 white king. (Positive = Black = P1, mirroring "P1 moves first".)
type Move ¶
type Move []int8
Move is a path of square indices: [from, to] for a simple move, or [from, over₁-landing, over₂-landing, …] for a jump sequence.
func LegalMoves ¶
LegalMoves generates all legal moves for side. If any capture exists, only (complete) capture paths are returned.