Tic-tac-toe: Difference between revisions

m
J: add whitespace (indent blocks)
m (J: add whitespace (indent blocks))
Line 993:
 
locate=: monad define
state=. y
m=. mark state
b=. board state
show '-->cell for ' , m , '?'
whilst. 9 = cell do. cell =. b i. {. (fread 1) , m end.
)
 
Line 1,022:
 
Note 'wrapped example to better fit wide display'
The state vector is 11 items long with
mark of the next player, mark of other player, 9 characters representing the board
 
NB. play the game -->cell for -? -->cell for -?
'@-'ttt'wersdfxcv' e v
w│e│r w│-│r .. w│-│@
─┼─┼─ .. ─┼─┼─ .. ─┼─┼─
s│d│f .. s│@│f .. s│@│f
─┼─┼─ .. ─┼─┼─ . ─┼─┼─
x│c│v .. x│c│v . x│c│-
-->cell for @? .. -->cell for @? . -->cell for @?
d .. r .. x
w│e│r .. w│-│@ .. w│-│@
─┼─┼─ .. ─┼─┼─ .. ─┼─┼─
s│@│f .. s│@│f ... s│@│f
─┼─┼─ .... ─┼─┼─ ... ─┼─┼─
x│c│v ..... x│c│v .. @│c│-
VICTORY
)
6,962

edits