[MWForum]Kock Snowflake
Bob Gorman
mwforum@lists.mathcats.com
Mon, 14 Jul 2003 17:06:19 -0400
--=====================_166911783==_
Content-Type: multipart/alternative;
boundary="=====================_166911794==_.ALT"
--=====================_166911794==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 03:45 PM 7/14/2003, you wrote:
>Can you help me program a Kock Snowflake? I THINK it would need
>recursion with a variable.
Attached is the code from Jim's Great Adventure.
code:
TO KOCH0 :SIZE
FD :SIZE
END
TO KOCH1 :SIZE
KOCH0 :SIZE/3 LT 60
KOCH0 :SIZE/3 RT 120
KOCH0 :SIZE/3 LT 60
KOCH0 :SIZE/3
END
TO KOCH2 :SIZE
KOCH1 :SIZE/3 LT 60
KOCH1 :SIZE/3 RT 120
KOCH1 :SIZE/3 LT 60
KOCH1 :SIZE/3
END
TO KOCH3 :SIZE
KOCH2 :SIZE/3 LT 60
KOCH2 :SIZE/3 RT 120
KOCH2 :SIZE/3 LT 60
KOCH2 :SIZE/3
END
TO QUADRIC :SIZE :LIMIT
IF :SIZE < :LIMIT [FD :SIZE STOP]
QUADRIC :SIZE/3 :LIMIT
LT 90
QUADRIC :SIZE/3 :LIMIT
RT 90
QUADRIC :SIZE/3 :LIMIT
RT 90
QUADRIC :SIZE/3 :LIMIT
LT 90
QUADRIC :SIZE/3 :LIMIT
END
TO SETUP1
CS PU SETPOS [-240 -120] PD RT 90
END
TO SETUP2
CS PU SETPOS [-240 -120] PD RT 90
END
TO SETUP3
PU HOME SETPOS [-240 -120] PD
RT 90
END
TO START
CS SETUP1 KOCH1 486
CS SETUP1 KOCH2 486
CS SETUP1 KOCH3 486
SETUP2 TRIAD 486 486
SETUP2 TRIAD 486 81
SETUP2 TRIAD 486 27
SETUP2 TRIAD 486 9
SETUP3 SETPC [255 0 0]
QUADRIC 486 486
SETUP3 SETPC [0 0 255]
QUADRIC 486 81
SETUP3 SETPC [0 255 0]
QUADRIC 486 27
SETUP3 SETPC[255 0 255]
QUADRIC 486 9
END
TO TRIAD :SIZE :LIMIT
IF :SIZE < :LIMIT [FD :SIZE STOP]
TRIAD :SIZE/3 :LIMIT
LT 60
TRIAD :SIZE/3 :LIMIT
RT 120
TRIAD :SIZE/3 :LIMIT
LT 60
TRIAD :SIZE/3 :LIMIT
END
Make "author [Michael Friendly]
Make "cc 3
Make "count 17
Make "date [Apr 29, 1987]
Make "dd 0
Make "file "FRACTALM
Make "from 2
Make "it "
Make "lastmove [3 1]
Make "moves 2
Make "needle1 [3]
Make "needle2 [1]
Make "needle3 [2]
Make "needlef [1]
Make "needlet [2]
Make "oldmoves [[3 1] [2 1] [] [] []]
Make "ringnum 3
Make "side 200
Make "starttime 13793167
Make "startup [START]
Make "to 3
Pprop ".system "BURY "TRUE
Pprop "@lst "BURY "TRUE
Pprop "aids "BURY "TRUE
Pprop "colors "BURY "TRUE
Pprop "drives "BURY "TRUE
Pprop "lstfiles "BURY "TRUE
Pprop "properties "BURY "TRUE
--=====================_166911794==_.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<font size=3>At 03:45 PM 7/14/2003, you wrote:<br>
<blockquote type=cite cite>Can you help me program a Kock Snowflake? I
THINK it would need<br>
recursion with a variable.</blockquote><br>
Attached is the code from Jim's Great Adventure.<br>
<br>
code:<br>
</font><font face="Courier, Courier" size=2>TO KOCH0
:SIZE
<br>
FD :SIZE<br>
END<br>
<br>
TO KOCH1 :SIZE<br>
KOCH0 :SIZE/3 LT 60<br>
KOCH0 :SIZE/3 RT 120<br>
KOCH0 :SIZE/3 LT 60<br>
KOCH0 :SIZE/3<br>
END<br>
<br>
TO KOCH2 :SIZE<br>
KOCH1 :SIZE/3 LT 60<br>
KOCH1 :SIZE/3 RT 120<br>
KOCH1 :SIZE/3 LT 60<br>
KOCH1 :SIZE/3<br>
END<br>
<br>
TO KOCH3 :SIZE<br>
KOCH2 :SIZE/3 LT 60<br>
KOCH2 :SIZE/3 RT 120<br>
KOCH2 :SIZE/3 LT 60 <br>
KOCH2 :SIZE/3 <br>
END<br>
<br>
TO QUADRIC :SIZE :LIMIT<br>
IF :SIZE < :LIMIT [FD :SIZE STOP]<br>
QUADRIC :SIZE/3 :LIMIT<br>
LT 90<br>
QUADRIC :SIZE/3 :LIMIT<br>
RT 90<br>
QUADRIC :SIZE/3 :LIMIT<br>
RT 90<br>
QUADRIC :SIZE/3 :LIMIT<br>
LT 90<br>
QUADRIC :SIZE/3 :LIMIT<br>
END<br>
<br>
TO SETUP1<br>
CS PU SETPOS [-240 -120] PD RT 90<br>
END<br>
<br>
TO SETUP2<br>
CS PU SETPOS [-240 -120] PD RT 90<br>
END<br>
<br>
TO SETUP3<br>
PU HOME SETPOS [-240 -120] PD<br>
RT 90<br>
END<br>
<br>
TO START<br>
CS SETUP1 KOCH1 486<br>
CS SETUP1 KOCH2 486<br>
CS SETUP1 KOCH3 486<br>
SETUP2 TRIAD 486 486<br>
SETUP2 TRIAD 486 81<br>
SETUP2 TRIAD 486 27<br>
SETUP2 TRIAD 486 9<br>
SETUP3 SETPC [255 0 0]<br>
QUADRIC 486 486<br>
SETUP3 SETPC [0 0 255]<br>
QUADRIC 486 81<br>
SETUP3 SETPC [0 255 0]<br>
QUADRIC 486 27<br>
SETUP3 SETPC[255 0 255]<br>
QUADRIC 486 9<br>
END<br>
<br>
TO TRIAD :SIZE :LIMIT<br>
IF :SIZE < :LIMIT [FD :SIZE STOP]<br>
TRIAD :SIZE/3 :LIMIT<br>
LT 60<br>
TRIAD :SIZE/3 :LIMIT<br>
RT 120<br>
TRIAD :SIZE/3 :LIMIT<br>
LT 60<br>
TRIAD :SIZE/3 :LIMIT<br>
END<br>
<br>
Make "author [Michael Friendly]<br>
Make "cc 3<br>
Make "count 17<br>
Make "date [Apr 29, 1987]<br>
Make "dd 0<br>
Make "file "FRACTALM<br>
Make "from 2<br>
Make "it "<br>
Make "lastmove [3 1]<br>
Make "moves 2<br>
Make "needle1 [3]<br>
Make "needle2 [1]<br>
Make "needle3 [2]<br>
Make "needlef [1]<br>
Make "needlet [2]<br>
Make "oldmoves [[3 1] [2 1] [] [] []]<br>
Make "ringnum 3<br>
Make "side 200<br>
Make "starttime 13793167<br>
Make "startup [START]<br>
Make "to 3<br>
Pprop ".system "BURY "TRUE<br>
Pprop "@lst "BURY "TRUE<br>
Pprop "aids "BURY "TRUE<br>
Pprop "colors "BURY "TRUE<br>
Pprop "drives "BURY "TRUE<br>
Pprop "lstfiles "BURY "TRUE<br>
Pprop "properties "BURY "TRUE<br>
<br>
</font></html>
--=====================_166911794==_.ALT--
--=====================_166911783==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="koch.lgo"
TO KOCH0 :SIZE
FD :SIZE
END
TO KOCH1 :SIZE
KOCH0 :SIZE/3 LT 60
KOCH0 :SIZE/3 RT 120
KOCH0 :SIZE/3 LT 60
KOCH0 :SIZE/3
END
TO KOCH2 :SIZE
KOCH1 :SIZE/3 LT 60
KOCH1 :SIZE/3 RT 120
KOCH1 :SIZE/3 LT 60
KOCH1 :SIZE/3
END
TO KOCH3 :SIZE
KOCH2 :SIZE/3 LT 60
KOCH2 :SIZE/3 RT 120
KOCH2 :SIZE/3 LT 60
KOCH2 :SIZE/3
END
TO QUADRIC :SIZE :LIMIT
IF :SIZE < :LIMIT [FD :SIZE STOP]
QUADRIC :SIZE/3 :LIMIT
LT 90
QUADRIC :SIZE/3 :LIMIT
RT 90
QUADRIC :SIZE/3 :LIMIT
RT 90
QUADRIC :SIZE/3 :LIMIT
LT 90
QUADRIC :SIZE/3 :LIMIT
END
TO SETUP1
CS PU SETPOS [-240 -120] PD RT 90
END
TO SETUP2
CS PU SETPOS [-240 -120] PD RT 90
END
TO SETUP3
PU HOME SETPOS [-240 -120] PD
RT 90
END
TO START
CS SETUP1 KOCH1 486
CS SETUP1 KOCH2 486
CS SETUP1 KOCH3 486
SETUP2 TRIAD 486 486
SETUP2 TRIAD 486 81
SETUP2 TRIAD 486 27
SETUP2 TRIAD 486 9
SETUP3 SETPC [255 0 0]
QUADRIC 486 486
SETUP3 SETPC [0 0 255]
QUADRIC 486 81
SETUP3 SETPC [0 255 0]
QUADRIC 486 27
SETUP3 SETPC[255 0 255]
QUADRIC 486 9
END
TO TRIAD :SIZE :LIMIT
IF :SIZE < :LIMIT [FD :SIZE STOP]
TRIAD :SIZE/3 :LIMIT
LT 60
TRIAD :SIZE/3 :LIMIT
RT 120
TRIAD :SIZE/3 :LIMIT
LT 60
TRIAD :SIZE/3 :LIMIT
END
Make "author [Michael Friendly]
Make "cc 3
Make "count 17
Make "date [Apr 29, 1987]
Make "dd 0
Make "file "FRACTALM
Make "from 2
Make "it "
Make "lastmove [3 1]
Make "moves 2
Make "needle1 [3]
Make "needle2 [1]
Make "needle3 [2]
Make "needlef [1]
Make "needlet [2]
Make "oldmoves [[3 1] [2 1] [] [] []]
Make "ringnum 3
Make "side 200
Make "starttime 13793167
Make "startup [START]
Make "to 3
Pprop ".system "BURY "TRUE
Pprop "@lst "BURY "TRUE
Pprop "aids "BURY "TRUE
Pprop "colors "BURY "TRUE
Pprop "drives "BURY "TRUE
Pprop "lstfiles "BURY "TRUE
Pprop "properties "BURY "TRUE
--=====================_166911783==_
Content-Type: multipart/alternative;
boundary="=====================_166911834==_.ALT"
--=====================_166911834==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
Fiction is for those who cannot deal with Reality;
Reality is for those who cannot deal with Fiction!
Bob Gorman
http://www.kncell.org
--=====================_166911834==_.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<font face="Comic Sans MS" size=3><i>Fiction is for those who cannot deal
with Reality;<br>
</i></font><font face="Tahoma" size=3><b>Reality is for those who cannot
deal with Fiction!<br>
<br>
</b></font><font size=3 color="#FF0000">Bob</font><font size=3>
</font><font size=3 color="#008080">Gorman<br>
</font><font size=3 color="#800000"><a href="http://www.kncell.org/" eudora="autourl">http://www.kncell.org</a></font><font size=3>
<br>
</font></html>
--=====================_166911834==_.ALT--
--=====================_166911783==_--