nx_folkgame_sow_lib.nx
buildroot/runtime/nx_folkgame_sow_lib.nx
about
nx_folkgame_sow_lib.nx -- THE SOW (MANCALA) FAMILY: pits, seeds, laps and capture.
Seven registry rows run on this one engine: Oware, Kalah, Congkak, Omweso, Tsoro, Pallanguzhi and
Bao. It reuses nx_folkgame_lib's image, save/restore and terminal plumbing entirely -- cells are
pits and state[c] is a SEED COUNT rather than an occupancy code. There is no second parser and no
second position representation.
THE INVARIANT THIS FAMILY IS PROVEN BY: sowing MOVES seeds, it never creates or destroys them.
Total seeds is conserved across every legal move from every reachable position, and that is
arithmetic rather than an opinion -- a sowing loop that is off by one anywhere breaks it, and no
implementation can satisfy it by accident. It is the sow family's answer to what the published
game-tree constant is for the align family.
HONEST DIFFERENCE, STATED NOT HIDDEN: unlike Tic-Tac-Toe's 255168 there is no cheap PUBLISHED
constant for these boards -- Oware was solved by Romein and Bal over 889 billion positions and
Kalah by Irving, Donkers and Uiterwijk, neither reproducible inside a gate. The external anchor
available to us is OpenSpiel's Oware, which its own table grades THOROUGHLY-TESTED, and wiring
that cross-check is the named rung. Until it lands, this family is proven by an exhaustive
invariant and NOT by an external count, and the gate says so in those words.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 1 importers
imports: nx_folkgame_lib.nx
imported by: nx_folkgame_sow_gate.nx
structs
| none |
consts
| 27 | const FGS_S_SCORE1: i64 = 8 |
| 28 | const FGS_S_SCORE2: i64 = 9 |
functions
| 30 | func fgs_perside(base: i64) -> i64 { let hd: *i64 = fg_hdr(base); return hd[FG_H_PERSIDE] } |
| 31 | func fgs_has_store(base: i64) -> i64 { let hd: *i64 = fg_hdr(base); return hd[FG_H_STORE] } |
| 32 | func fgs_store_cell(base: i64, side: i64) -> i64 |
| 38 | func fgs_first(base: i64, side: i64) -> i64 |
| 42 | func fgs_last(base: i64, side: i64) -> i64 |
| 47 | func fgs_owns(base: i64, side: i64, c: i64) -> i64 |
| 53 | func fgs_score(base: i64, side: i64) -> i64 |
| 59 | func fgs_add_score(base: i64, side: i64, n: i64) -> i64 |
| 70 | func fgs_total(base: i64) -> i64 |
| 81 | func fgs_expected(base: i64) -> i64 |
| 86 | func fgs_reset(base: i64) -> i64 |
| 102 | func fgs_next(base: i64, side: i64, c: i64) -> i64 |
| 121 | func fgs_sow(base: i64, pit: i64) -> i64 |
| 155 | func fgs_apply_raw(base: i64, pit: i64) -> i64 |
| 202 | func fgs_feeds(base: i64, pit: i64, snap: *i64) -> i64 |
| 221 | func fgs_moves(base: i64, out: *i64, snap: *i64) -> i64 called by 3: fgg_walkfgg_open_movesfgs_terminal calls 7: fg_hdrfg_sidefg_scalfgs_firstfgs_lastfg_at+1 |
| 247 | func fgs_apply(base: i64, pit: i64, snap: *i64) -> i64 |
| 264 | func fgs_terminal(base: i64, snap: *i64, scratch: *i64) -> i64 |