Langton's ant: Difference between revisions

Content added Content deleted
(Added Quackery.)
Line 6,976: Line 6,976:
</syntaxhighlight>
</syntaxhighlight>
The output is similar to the basic D version.
The output is similar to the basic D version.

=={{header|Quackery}}==

<syntaxhighlight lang="Quackery"> [ stack 50 ] is xpos ( --> s )
[ stack 50 ] is ypos ( --> s )

[ xpos share 0 100 within
ypos share 0 100 within
and ] is inside ( --> b )

[ -1 ypos ] is north ( --> n s )
[ 1 xpos ] is east ( --> n s )
[ 1 ypos ] is south ( --> n s )
[ -1 xpos ] is west ( --> n s )

[ stack 0 ] is heading ( --> s )

[ 1 ] is right ( --> n )
[ -1 ] is left ( --> n )

[ heading take
+ 4 mod
heading put ] is turn ( --> )

[ heading share
[ table
north east south west ]
do tally ] is move ( --> )

[ ypos share peek
xpos share bit & 0 > ] is black? ( [ --> b )

[ ypos share
2dup peek
xpos share bit ~ &
unrot poke ] is white ( [ --> [ )

[ ypos share
2dup peek
xpos share bit |
unrot poke ] is black ( [ --> [ )

[ 50 xpos replace
50 ypos replace
0 heading replace ] is reset ( --> )

[ witheach
[ 100 times
[ dup i^ bit &
iff say "[]"
else say " " ]
cr
drop ] ] is draw ( [ --> )

[ reset
0 100 of
[ inside while
dup black? iff
[ white left ]
else
[ black right ]
turn
move
again ]
draw ] is ant ( --> )</syntaxhighlight>

{{out}}

Surplus whitespace trimmed. Shown at <sup>'''1'''</sup>/<sub>'''2'''</sub> size

<pre style="font-size:67%">
[][] [][][][][][][][][][][][] [][]
[] [][][][] [] [][]
[][][] [][] [][] []
[] [] [] [] [] []
[][] [][] [] [] [][][] []
[][][] [] [] [] [] [][] [][] [][][]
[] [] [][][] [][] [][][][] [][] [] [] [] [][] [][]
[] [][][] [][] [] [][] [][][] [] [] [][][] [][][]
[] [] [][][][][] [] [] [][][][] [] [][][] [] [] []
[][][] [][] [] [][][][] [][] [][] [][][][][][] [] [][][] [] []
[] [][][] [] [][] [] [] [][] [][] [][] [] [][][][][] [][][] [][]
[] [] [] [][] [][][] [] [] [] [][][][] [] [][]
[] [] [][] [][] [] [][] [][] [] [][]
[][][] [] [] [][] [][][] [] [][] [] [][][] [][] [][] []
[] [][][] [][] [][] [][] [][][] [] [] [][] [][][][] []
[][][] [] [] [] [] [] [][][][] [][] [] [][] [][][] [] []
[] [][][] [] [][] [] [] [][][] [] [][][] [][] [] [] [][]
[][][] [] [] [][] [] [][] [][] [][][][][] [][][][] [][][][] [][] []
[] [][][] [] [] [] [] [][][] [] [] [][] [][] [] [] [] [] []
[][][] [] [][] [][][] [][] [] [][] [][][][] [][][][] [] []
[] [][][] [] [] [] [][] [][][][][][][][][][][] [] [][][][] [] [] []
[][][] [] [][] [] [][][][] [][] [][][][][][][][][] [] [][] [] [][]
[] [][][] [] [] [][] [] [][] [][] [][] [][][] [][][] [] [] [][] [][][][] []
[][][] [] [][] [] [] [][][][][][] [][] [] [][] [] [] [][][] [][][] [][] []
[] [][][] [] [] [] [][][][][] [] [][][][][] [] [] [][] [] [][] []
[][][] [] [][] [] [] [][] [][][][][] [][] [] [] [] [] [][] [] [] []
[] [][][] [] [] [] [] [][][][] [] [][][][][] [][] [][][][][][][][][][] [][]
[][][] [] [][] [] [][] [][] [] [] [][][][] [] [][] [][][][] [][]
[] [][][] [] [] [][][][][] [] [][] [][] [] [] [] [] [] [] [] []
[][][] [] [][] [][] [][] [] [] [] [][] [][] [] [] [][] [] [][] [][]
[] [][][] [] [] [] [] [] [][][][][][][][] [] [] [][] [][][][] []
[][][] [] [][] [] [] [] [][] [][] [] [] [][] []
[] [][][] [] [] [] [] [] [] [][] [][] [][] [][][][]
[][][] [] [][] [][] [] [][] [][] [] [] [][][]
[] [][][] [] [] [] [][] [][][][] [][][][] [][][] [][][][]
[][][] [] [][] [][] [][][][] [][] [] [][] [] [] []
[] [][][] [] [] [][] [][] [][] [][][] [][] [][][][][]
[][][] [] [][] [] [][] [] [][][][]
[] [][][] [] [] [][] [][] [][]
[][][] [] [][] [][]
[] [][][] [] [] [] [][] [][][][] []
[][][] [] [][] [] [] [][][] [][][]
[] [][][] [] [] [] [][] [] [] []
[][][] [] [][] [][] [][]
[] [][][] [] [] [][]
[][][] [] [][]
[] [] [] [] []
[][][][] [][]
[] [][] []
[][][][]
[][]</pre>


=={{header|R}}==
=={{header|R}}==