code wiki / _hdl_build / _pe_poker_round.nx

_pe_poker_round.nx source

↩ module page · 43 lines · 1534 B

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