code wiki / _hdl_build / nx_creature_game.nx

nx_creature_game.nx

buildroot/runtime/_hdl_build/nx_creature_game.nx

4323 B80 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind librarytopic creature
docsdependenciesstructsconstsfunctions

about

nx_creature_game.nx -- the creature-collector exposed as a REAL, PLAYABLE black-box interface (so an automated playtester can drive it blind, like a player). Genuine agency + fail states: encounters are TWO-WAY (the wild fights back; your lead can FAINT = lose), balls are limited, KOing a wild loses the catch, the route ends. WIN = catch the goal number of creatures; LOSE = lead faints / route ends short / step cap. Interface the playtester is allowed to use: cg_init / cg_status / cg_nlegal / cg_observe / cg_step. NO privileged internals. Pure-integer, deterministic. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_creature_battle.nx nx_creature_world.nx nx_syscalls.nx nx_creature_game.nx nx_playtest_creature.nx

imports: nx_creature_battle.nxnx_creature_world.nxnx_syscalls.nx

imported by: nx_playtest_creature.nx

structs

none

consts

10const CG_MAGIC_1103515245: i64 = 1103515245
11const CG_MAGIC_12345: i64 = 12345
12const CG_MAGIC_32767: i64 = 32767
14const CG_LEAD: i64 = 8 // lead creature at st[8..31]
15const CG_WILD: i64 = 32 // wild creature at st[32..55]
16const CG_STEP_CAP: i64 = 500

functions

18func st_rngbox(st: *i64) -> *i64 { return ((st as i64) + 58*8) as *i64 }
19func cg_rng(st: *i64) -> i64 { let b: *i64 = st_rngbox(st); var x: i64 = b[0]; x = x*CG_MAGIC_1103515245 + CG_MAGIC_12345; b[0] = x; return (x >> 16) & CG_MAGIC_32767 }
called by 1: cg_step calls 1: st_rngbox
21func cg_init(seed: i64) -> *i64
called by 1: pt_session calls 3: sys_mmapcb_setcb_addmove
32func cg_status(st: *i64) -> i64 { if st[0] == 2 { return 1 } if st[0] == 3 { return 2 } return 0 }
called by 1: pt_session
33func cg_nlegal(st: *i64) -> i64 { if st[0] == 1 { return 4 } if st[0] == 0 { return 1 } return 0 }
called by 1: pt_session
35func cg_observe(st: *i64, o: *i64) -> i64
called by 1: pt_session
42func cg_wild_attacks(st: *i64, lead: *i64, wild: *i64) -> i64
called by 1: cg_step calls 3: cb_bestcb_damagest_rngbox
50func cg_step(st: *i64, a: i64) -> i64