code wiki / (root) / nx_math_games.nx

nx_math_games.nx

buildroot/runtime/nx_math_games.nx

5028 B136 linesdepth 5pulls 8 transitivereach 1 importersview sourcekind librarytopic math
docsdependenciesstructsconstsfunctions

about

nx_math_games.nx -- entry-level math games + puzzles + riddles for the pedagogy bridge (kindergarten -> advanced). Per comprehensive-proofs + bits-up-pedagogy cardinal 2026-05-14: substrate must bridge entry-level beginner -> advanced math via games, riddles, fun puzzles. All primitives substrate-native; no Python / JavaScript / external dependencies. Per "no null-where-null-shouldnt-be" cardinal 2026-05-14: functions that can fail return *NxResult rather than -1 sentinels. Callers MUST check nx_result_is_ok before unwrapping.

dependencies 6 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_classical_unpatented.nx nx_classical_unpatented_2.nx nx_result.nx nx_math_games.nx nx_math_games_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_classical_unpatented.nxnx_classical_unpatented_2.nxnx_result.nx

imported by: nx_math_games_test.nx

structs

none

consts

28const NX_GAME_GUESS_LOW: nx_int = -1
29const NX_GAME_GUESS_HIGH: nx_int = 1
30const NX_GAME_GUESS_CORRECT: nx_int = 0
39const NX_GAME_PARITY_EVEN: nx_int = 0
40const NX_GAME_PARITY_ODD: nx_int = 1
61const NX_GAME_PATTERN_ARITH: nx_int = 1
62const NX_GAME_PATTERN_GEOM: nx_int = 2
63const NX_GAME_PATTERN_NONE: nx_int = 0

functions

32func nx_game_guess_check(secret: nx_int, guess: nx_int) -> nx_int
called by 1: main
42func nx_game_parity(n: nx_int) -> nx_int
called by 1: main
50func nx_game_find_factor(n: nx_int) -> *NxResult
called by 1: main calls 2: nx_result_errnx_result_ok
65func nx_game_pattern_kind(a: nx_int, b: nx_int, c: nx_int) -> nx_int
74func nx_game_pattern_next(a: nx_int, b: nx_int, c: nx_int) -> *NxResult
85func nx_riddle_pigeonhole(n_pigeons: nx_int, n_holes: nx_int) -> *NxResult
called by 1: main calls 2: nx_result_errnx_result_ok
92func nx_riddle_triangle_n(n: nx_int) -> *NxResult
called by 1: main calls 2: nx_result_errnx_result_ok
98func nx_riddle_hanoi_moves(n: nx_int) -> *NxResult
called by 1: main calls 2: nx_result_errnx_result_ok
107func nx_riddle_coin_flip_outcomes(n: nx_int) -> *NxResult
called by 1: main calls 2: nx_result_errnx_result_ok
117func nx_puzzle_caesar_decrypt(c: nx_int, k: nx_int) -> nx_int
called by 1: main
128func nx_puzzle_magic_3x3_check(a: nx_int, b: nx_int, c: nx_int) -> nx_int
called by 1: main
134func nx_puzzle_fib(n: nx_int) -> nx_int
called by 1: main calls 1: nx_fibonacci