h╩mw2.0 Englishprojectsize[744 426]turtles-have[]globals[]globals-list[globals-vars] shapesкproceduresЫtext{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss\fprq2 System;}{\f3\fswiss Arial;}{\f4\fmodern\fprq1 Courier New;}} {\colortbl\red0\green0\blue0;\red0\green128\blue128;\red0\green0\blue255;} \deflang1033\pard\plain\f4\fs20\cf1 ; Purpose: To create a Sierpinski sieve \par ; Copyright \plain\lang3081\f4\fs20\cf1 \'a9\plain\f4\fs20\cf1 2004 by Rupert Russell \par ; e-mail: r.russell@ballarat.edu.au \par ; URL: http://velorum.ballarat.edu.au/~rrussell/microworlds/ \par ; Created: October 10, 2004 \par ; \par ; Based on code from: \par \plain\f4\fs20\cf1\b ; Bill Beaumont Paul Scott\plain\f4\fs20\cf1 \par ; w.beaumont@computer.org mail@paulscott.info \par ; http://www.bold.net.au/~willy http://paulscott.info \par \plain\f4\fs16\cf2 ; http://www.maths.adelaide.edu.au/people/pscott/fractals/fu10.html#Anchor55555\plain\f4\fs20\cf1 \par ; \par ; This program is free software; you can redistribute it and/or modify \par ; it under the terms of the GNU General Public License as published by \par ; the Free Software Foundation; either version 2 of the License, or \par ; (at your option) any later version. \par ; \par ; This program is distributed in the hope that it will be useful, \par ; but WITHOUT ANY WARRANTY; without even the implied warranty of \par ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \par ; GNU General Public License for more details. \par ; \par ; You should have received a copy of the GNU General Public License \par ; along with this program; if not, write to the Free Software \par ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. \par ; ----------------------------------------------------------------------\plain\f4\fs20\cf0 \par \plain\f4\fs20 ; \par \plain\f4\fs20\cf1 ; Iterative function systems (II) \par ; This program uses an IFS to generate the Sierpinski sieve from an \par ; initial triangle. Pairs of coordinates [x y] represent points. \par ; Variables p1, p2 and p3 are points of this kind; the initial triangle \par ; vertices are given in the ifs command below the line in the box. \par ; Procedures x and y use the primitives first and item to extract the \par ; individual coordinates from a point. The scale procedure scales the \par ; points from the unit square (where the calculations are done) to \par ; reasonable values for the Logo screen. The se (sentence) primitive \par ; joins two numbers to make a coordinate pair. The triangle procedure \par ; draws a triangle using three given points. \par \par ; The three IFS mapping rules for the Sierpinski sieve are encoded in \par ; the rule procedure. Procedure ifs applies these mappings to the \par ; initial triangle, and as many times as the level parameter indicates. \par \plain\f4\fs20\b \par \par to x :p \plain\f4\fs20 \par output first :p \par \plain\f4\fs20\b end \par \par to y :p \plain\f4\fs20 \par ;output item 2 :p \par output last :p \par \plain\f4\fs20\b end \par \par to scale_triangle :p \par \plain\f4\fs20 output se (x :p) * scale - scale / 2 (y :p) * scale - scale / 2 \par \plain\f4\fs20\b end \par \par to triangle :p1 :p2 :p3\plain\f4\fs20 \par pu \par setpos scale_triangle :p1 \par pd \par setpos scale_triangle :p2 \par setpos scale_triangle :p3 \par setpos scale_triangle :p1 \par \plain\f4\fs20\b end \par \par to rule :n :p\plain\f4\fs20 \par if :n = 1 [output se (x :p) / 2 (y :p) / 2] \par if :n = 2 [output se (x :p) / 2 + 0.5 (y :p) / 2] \par if :n = 3 [output se (x :p) / 2 + 0.25 (y :p) / 2 + 0.5] \par \plain\f4\fs20\b end \par \par to ifs :p1 :p2 :p3 :level\plain\f4\fs20 \par if :level = 0 [triangle :p1 :p2 :p3 stop] \par ifs rule 1 :p1 rule 1 :p2 rule 1 :p3 :level - 1 \par ifs rule 2 :p1 rule 2 :p2 rule 2 :p3 :level - 1 \par ifs rule 3 :p1 rule 3 :p2 rule 3 :p3 :level - 1 \par \plain\f4\fs20\b end \par \par to go \par \plain\f4\fs20 ht \par cc\plain\f4\fs20\b \par \plain\f4\fs20 cg IFS [0 0] [1 0] [0.5 1] level\plain\f4\fs20\b \par end\plain\f4\fs20 \par } H╣pagenamepage1curturtlet1curtext||transition0Dturtle-deamons[[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []]Cmouse-deamons[[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []]bg0║╡bufferшкг╡$6HZl~Рв┤╞╪ъ -Fa|См╧Є<]rН░╙·!<cЪ╙ EZuШ┐ц (OЖ┴;nЙ░ч]Ь├a─% Ж Ы ╢ ┘ № # J e М ├ · 5 p г ╛ х  S Т ╤ ° 7 Ц ∙ \┐┌8w╢ї[║!РўNu┤rсPП■нd╞█Ў<cКе╠:u░у■%\У╥8w╓9Ь Ax╖Ў5\Ы·a╨7 О ╡ Ї S!▓!!"Р"╧">#э#д$W% &%&L&Г&║&∙&8'_'Ю'¤'\(├(*)Б)и)ч)F*е*+Г+┬+1,р,Ч-N./,/k/╩/90и01V1┼1t2334┴4`5Я56╜6l7;8 9y9H:Ч;Ў<G>Ш?░?╬?Ї?@D@n@М@╢@Ё@*AhAжA▄A·A$B^BШB┌BCFCИCъCPD╢DE:EdEЮEрEF\FАF╝FG|GшGLHаH─HI\I╕I$JРJ╠J8KфKШLHM°MN4NhNЬN╪NO8OtO╨O,PРPЇPHQlQиQR`R╠R8StSрSЛT