code wiki / _hdl_build / nx_user_sim_games.nx

nx_user_sim_games.nx

buildroot/runtime/_hdl_build/nx_user_sim_games.nx

6438 B142 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic user
docsdependenciesstructsconstsfunctions

about

nx_user_sim_games.nx -- CHAOS-USER simulator for the C-stage games (operator: "playtesting isnt just api but actually mimics real users"). Drives nx_tictactoe and nx_checkers through the EXACT functions the browser click-handlers call (nx_ttt_try_apply / nx_ttt_pick / nx_chk_apply_*) -- the WASM export surface IS the UI's entry surface -- but in REAL-USER patterns, not happy-path API order: * misclicks: occupied cells, out-of-range indices, double-clicks * impatient clicking after the game has ended * full seeded games to termination against the AI Asserts the invariants a real player experiences: illegal input is a visible no-op (state hash unchanged), games terminate, the perfect AI never loses, a finished board ignores clicks. This is the P0 guided-bot seed from the honesty roadmap. Honest scope: covers the export surface; true DOM-event/pixel mimicry needs the SS22.5 sovereign browser-test-runner (PM plan). Catches the W/S-inversion CLASS at the state layer: user input -> wrong state transition. Exit: 0 all green (prints USER-SIM ALL-PASS); 1-6 = failing invariant. license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_tictactoe.nx nx_checkers.nx nx_prng.nx nx_user_sim_games.nx

imports: nx_syscalls.nxnx_tier.nxnx_tictactoe.nxnx_checkers.nxnx_prng.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_prng_init nx_ttt_new sys_mmap nx_ttt_outcome nx_ttt_turn nx_prng_range nx_prng_next nx_ttt_state_hash nx_ttt_try_apply nx_ttt_is_legal nx_ttt_other nx_ttt_evaluate nx_ttt_pick_perfect nx_ttt_try_apply ↻ nx_ttt_minimax nx_ttt_try_apply ↻ nx_ttt_minimax ↻ nx_ttt_undo nx_ttt_undo ↻ nx_ttt_winner sys_mmap ↻ nx_chk_new sys_mmap ↻ nx_chk_is_dark nx_chk_sq nx_chk_outcome nx_chk_turn nx_chk_count_side nx_chk_side_of nx_chk_is_red nx_chk_is_black nx_chk_apply_simple_move nx_chk_in_bounds nx_chk_is_dark ↻ nx_chk_sq ↻ nx_chk_side_of ↻ nx_chk_jumps_exist sys_mmap ↻ nx_chk_legal_jumps

structs

none

consts

26const K_MAGIC_20260610: i64 = 20260610

functions

28func us_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
30func main() -> nx_int