Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
62
Task/Langtons-ant/Quackery/langtons-ant.quackery
Normal file
62
Task/Langtons-ant/Quackery/langtons-ant.quackery
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
[ 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 ( --> )
|
||||
Loading…
Add table
Add a link
Reference in a new issue