summaryrefslogtreecommitdiff
path: root/chapter31/docs/examples/TicTacToe.smp
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-11-13 16:17:13 -0800
committerCliff Click <cliffc@acm.org>2026-11-13 16:17:13 -0800
commitafcf96444366fb4b7c83f938763013cbc360aade (patch)
tree67eb69ac6cc58322549020550d48aceb8f2f5ff8 /chapter31/docs/examples/TicTacToe.smp
parentd2c59dbe9d6cc8dc4ff4d1e7949bfeddd8bef5d0 (diff)
downloadSimple-afcf96444366fb4b7c83f938763013cbc360aade.tar.gz
Simple-afcf96444366fb4b7c83f938763013cbc360aade.zip
Array init syntaxmain
New array init syntax; used in a bunch of places. Allows e.g. read-only arrays with not-null entries. Fix bug x86 encoding of mem/cmp/fp compares
Diffstat (limited to 'chapter31/docs/examples/TicTacToe.smp')
-rw-r--r--chapter31/docs/examples/TicTacToe.smp3
1 files changed, 1 insertions, 2 deletions
diff --git a/chapter31/docs/examples/TicTacToe.smp b/chapter31/docs/examples/TicTacToe.smp
index a710e440..1e0f3ca0 100644
--- a/chapter31/docs/examples/TicTacToe.smp
+++ b/chapter31/docs/examples/TicTacToe.smp
@@ -3,8 +3,7 @@ val main = { u8[~][] args ->
sys.io.p("Tic-tac-toe!\nYou are X; the CPU is O. You go first.\n");
sys.io.p("Press a square's number (no Enter needed), or q/Esc to quit.\n");
sys.io.p("Squares:\n 1 | 2 | 3 \n---+---+---\n 4 | 5 | 6 \n---+---+---\n 7 | 8 | 9 \n\n");
- val board = new u8[9];
- for( int i=0; i<board#; i++ ) board[i]=' ';
+ val board = new u8[9]{ int i -> ' '; }; // Initialize the board
// Draw empty board
_draw(board);