code wiki / (root) / nx_checkers.nx

nx_checkers.nx

buildroot/runtime/nx_checkers.nx

32885 B832 linesdepth 3pulls 3 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_checkers.nx -- C1 of the bootstrap-to-generative trajectory. Standard 8x8 American checkers (English draughts). Pieces on dark squares only; 12 pieces per side; men move forward diagonally, kings move both directions. Captures are jumps over an adjacent opponent to an empty square; multi-captures chain. Win when opponent has no legal moves (no pieces left or all blocked). This file (C1a) ships: - Piece + outcome sealed-enum constants - State block layout (8x8 board + turn + outcome + force-continue) - Allocation + standard starting position - Accessors (cell, turn, outcome, force_continue) - Coordinate helpers (is_dark_square, in_bounds) Deferred to C1b+: - Legal-move generation (simple moves + jumps + mandatory captures) - Multi-capture chaining - Kinging on reaching far row - Win-condition evaluation - AI tiers (easy random / medium 1-ply / minimax-depth-N) - HTML UI + WASM delivery + playwright audit genealogy_id: nx_checkers_v1_2026_05_19 lineage_id: abstract_classic_8x8_game_state_machine license: operator-as-sole-author (per ยง23.1 open question) complexity: O(1) accessors; O(8) legal-move gen per piece; AI depth-bounded

dependencies 3 imports · 4 importers

nx_syscalls.nx nx_tier.nx nx_prng.nx nx_checkers.nx nx_checkers_render.nx nx_checkers_test.nx nx_chk_bits_up_e2e.nx nx_user_sim_games.nx

imports: nx_syscalls.nxnx_tier.nxnx_prng.nx

imported by: nx_checkers_render.nxnx_checkers_test.nxnx_chk_bits_up_e2e.nxnx_user_sim_games.nx

structs

none

consts

40const NX_CHK_AI_EASY: i64 = 0 // random legal action
41const NX_CHK_AI_MEDIUM: i64 = 1 // (deferred) 1-ply heuristic
42const NX_CHK_AI_HARD: i64 = 2 // (deferred) minimax depth-N alpha-beta
46const NX_CHK_EMPTY: i64 = 0
47const NX_CHK_RED_MAN: i64 = 1
48const NX_CHK_RED_KING: i64 = 2
49const NX_CHK_BLACK_MAN: i64 = 3
50const NX_CHK_BLACK_KING: i64 = 4
56const NX_CHK_RED: i64 = 1
57const NX_CHK_BLACK: i64 = 2
61const NX_CHK_ONGOING: i64 = 0
62const NX_CHK_WIN_RED: i64 = 1
63const NX_CHK_WIN_BLACK: i64 = 2
64const NX_CHK_DRAW: i64 = 3
77const NX_CHK_OFF_BOARD: i64 = 0
78const NX_CHK_OFF_TURN: i64 = 64
79const NX_CHK_OFF_OUTCOME: i64 = 65
80const NX_CHK_OFF_FORCE_CONTINUE: i64 = 66
81const NX_CHK_OFF_PLIES: i64 = 67
82const NX_CHK_STATE_CELLS: i64 = 68

functions

89func nx_chk_in_bounds(row: i64, col: i64) -> i64
97func nx_chk_is_dark(row: i64, col: i64) -> i64
105func nx_chk_sq(row: i64, col: i64) -> i64
111func nx_chk_new() -> *i64
153func nx_chk_cell(s: *i64, row: i64, col: i64) -> i64
called by 1: main calls 2: nx_chk_in_boundsnx_chk_sq
158func nx_chk_cell_by_sq(s: *i64, sq: i64) -> i64
164func nx_chk_turn(s: *i64) -> i64
168func nx_chk_outcome(s: *i64) -> i64
172func nx_chk_force_continue(s: *i64) -> i64
176func nx_chk_plies(s: *i64) -> i64
called by 1: main
182func nx_chk_is_red(piece: i64) -> i64
called by 1: nx_chk_side_of
188func nx_chk_is_black(piece: i64) -> i64
called by 1: nx_chk_side_of
194func nx_chk_is_king(piece: i64) -> i64
201func nx_chk_side_of(piece: i64) -> i64
208func nx_chk_other(side: i64) -> i64
214func nx_chk_count_side(s: *i64, side: i64) -> i64
called by 2: mainmain calls 1: nx_chk_side_of
458func nx_chk_piece_can_jump_from(s: *i64, sq: i64) -> i64
524func nx_chk_jumps_exist(s: *i64, side: i64) -> i64
563func nx_chk_check_outcome(s: *i64)
597func nx_chk_apply_simple_move(s: *i64, from_row: i64, from_col: i64,
687func nx_chk_apply_jump(s: *i64, from_row: i64, from_col: i64,
784func nx_chk_apply_move(s: *i64, from_row: i64, from_col: i64,
801func nx_chk_pick_easy(s: *i64, side: i64, prng_state: *i64, out_move: *i64) -> i64
829func nx_chk_pick(s: *i64, side: i64, difficulty: i64,
called by 1: _chk_ai_take_turn calls 1: nx_chk_pick_easy