Tic-tac-toe: Difference between revisions

Content deleted Content added
Cchando (talk | contribs)
→‎J: Remove trivial exposition.
Tags: Mobile edit Mobile web edit
Cchando (talk | contribs)
Tags: Mobile edit Mobile web edit
Line 6,693: Line 6,693:
show=: [ [: echo@''@echo (,' '&,)/"1@('.XO'{~3 3$board) [ echo@''
show=: [ [: echo@''@echo (,' '&,)/"1@('.XO'{~3 3$board) [ echo@''
won=: [:+./ (3=[:|+/)"1@(], |:, (<@i.@2|:]),: <@i.@2|:|.)@(3 3$board)
won=: [:+./ (3=[:|+/)"1@(], |:, (<@i.@2|:]),: <@i.@2|:|.)@(3 3$board)
prompt=: echo@:>:@i.@3 3 [ echo@'enter a move (1–9) each turn; you''re X''s'
prompt=: echo@:>:@i.@3 3@echo@'enter a move (1–9) each turn; you''re X''s'
outcome=: (' wins'echo@,~'.XO'{~-@turn)`(echo@'tie')@.(1:i.~won,full)
outcome=: (' wins'echo@,~'.XO'{~-@turn)`(echo@'tie')@.(1:i.~won,full)
ttt=: outcome@([F.(show@move[_2:Z:won+.full))@(10{._1)@prompt
ttt=: outcome@([F.(show@move[_2:Z:won+.full))@(10{._1)@prompt