code wiki / _hdl_build / nx_creature_game.nx
nx_creature_game.nx
buildroot/runtime/_hdl_build/nx_creature_game.nx
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
imports: nx_creature_battle.nxnx_creature_world.nxnx_syscalls.nx
imported by: nx_playtest_creature.nx
structs
| none |
consts
| 10 | const CG_MAGIC_1103515245: i64 = 1103515245 |
| 11 | const CG_MAGIC_12345: i64 = 12345 |
| 12 | const CG_MAGIC_32767: i64 = 32767 |
| 14 | const CG_LEAD: i64 = 8 // lead creature at st[8..31] |
| 15 | const CG_WILD: i64 = 32 // wild creature at st[32..55] |
| 16 | const CG_STEP_CAP: i64 = 500 |
functions
| 18 | func st_rngbox(st: *i64) -> *i64 { return ((st as i64) + 58*8) as *i64 } |
| 19 | func 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 } |
| 21 | func cg_init(seed: i64) -> *i64 |
| 32 | func cg_status(st: *i64) -> i64 { if st[0] == 2 { return 1 } if st[0] == 3 { return 2 } return 0 } called by 1: pt_session |
| 33 | func cg_nlegal(st: *i64) -> i64 { if st[0] == 1 { return 4 } if st[0] == 0 { return 1 } return 0 } called by 1: pt_session |
| 35 | func cg_observe(st: *i64, o: *i64) -> i64 called by 1: pt_session |
| 42 | func cg_wild_attacks(st: *i64, lead: *i64, wild: *i64) -> i64 |
| 50 | func cg_step(st: *i64, a: i64) -> i64 |