code wiki / _hdl_build / _ttt_test_trace.nx
_ttt_test_trace.nx
buildroot/runtime/_hdl_build/_ttt_test_trace.nx
about
nx_tictactoe_test.nx -- C0 substrate smoke.
12 deterministic assertions covering:
1. new game has X to move + outcome ongoing
2. 9 legal moves on a fresh board
3. apply X to cell 4 -> board[4]=X, turn=O, 8 legal moves left
4. illegal-move (occupied cell) is no-op
5. illegal-move (out-of-range) is no-op
6. horizontal-row win is detected (top row XXX)
7. diagonal win is detected (0-4-8 XXX)
8. draw is detected after 9 non-winning moves
9. state-hash is deterministic for same state
10. perfect-vs-perfect always ends in draw (game-theory invariant)
11. perfect-vs-random never loses (perfect's score never negative)
12. evaluate updates only the OUTCOME and WINNER cells (does not mutate board)
Each failed assertion exits with a distinct non-zero code so the smoke
harness identifies which check fired.
Composes [[feedback-bug-class-prevention-additive-not-restrictive]] +
ยง22 bug-class table entry "move-applies-to-wrong-cell" (the tic-tac-toe
equivalent of the W/S inversion class).
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nxnx_tictactoe.nxnx_prng.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 29 | func tt_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 30 | func tt_putn(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;k=1}; while m>0 {t[k]=48+(m%10); m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(1, bb, k); return 0 } |
| 32 | func main() -> nx_int |