Tic-tac-toe: Difference between revisions

Content added Content deleted
m (→‎{{header|Tailspin}}: use tagged identifiers)
Line 13,377: Line 13,377:
<lang tailspin>
<lang tailspin>
processor Tic-Tac-Toe
processor Tic-Tac-Toe
@: [1..9];
@: [1..9 -> (position:$) -> $::value];


source isWonOrDone
source isWonOrDone
Line 13,387: Line 13,387:
when <~=[]> do $(1) !
when <~=[]> do $(1) !
\) !
\) !
when <[<=$(first)>+ VOID]> do '$(first); wins!'!
when <[<=$(first)::raw>+ VOID]> do '$(first); wins!'!
end isWonOrDone
end isWonOrDone


Line 13,395: Line 13,395:


templates move
templates move
when <?($@Tic-Tac-Toe <[<=$.position>]>)> do @Tic-Tac-Toe($.position): $.mark;
when <?($@Tic-Tac-Toe($.position) <position>)> do @Tic-Tac-Toe($.position): $.mark;
$ !
$ !
otherwise
otherwise
Line 13,420: Line 13,420:
[{mark: $@play, position: $IN::readline -> toInt} -> board::move] -> #
[{mark: $@play, position: $IN::readline -> toInt} -> board::move] -> #
otherwise
otherwise
$(1) !
$(1) !
end getMove
end getMove