code wiki / _hdl_build / _pe_stealth.nx

_pe_stealth.nx source

↩ module page · 29 lines · 948 B

1// AUTHORED BY THE NISHI BUILDER (pattern: STATE_MACHINE) -- baked transition walk, no Claude logic 2import "nx_syscalls.nx" 3func _pe_stealth_step(s: i64, e: i64) -> i64 { 4 if s < 0 { return 0 - 1 } 5 if s >= 5 { return 0 - 1 } 6 if e < 0 { return 0 - 1 } 7 if e >= 5 { return 0 - 1 } 8 if s == 0 { if e == 0 { return 1 } } 9 if s == 0 { if e == 1 { return 2 } } 10 if s == 0 { if e == 4 { return 4 } } 11 if s == 1 { if e == 1 { return 2 } } 12 if s == 1 { if e == 2 { return 0 } } 13 if s == 1 { if e == 4 { return 4 } } 14 if s == 2 { if e == 2 { return 3 } } 15 if s == 2 { if e == 4 { return 4 } } 16 if s == 3 { if e == 1 { return 2 } } 17 if s == 3 { if e == 3 { return 0 } } 18 return 0 - 1 19} 20func _pe_stealth_run(ev: *i64, n: i64, s0: i64) -> i64 { 21 var s: i64 = s0 22 var i: i64 = 0 23 while i < n { 24 s = _pe_stealth_step(s, ev[i]) 25 if s < 0 { return 0 - 1 } 26 i = i + 1 27 } 28 return s 29}