V Jones (19/8/98) has produced a beautiful fractal in his Seirpinski's
Carpet program. I have taken the liberty of modifying and expanding the
sq_seirp procedure in order to make the program into a microworld
user-friendly for children 9 years and older. They aim is that they have
access to the beauty of the fractals produced, and that induction of the
pattern of the fractals as the levels deepen is facilitated.
The enhancements I have added are the placing of the fractals produced
side-by-side so that they can be compared, and the printing to the graphics
screen of a label for each fractal stating its level of recursion. I
envisage the teacher challenging the students to be systematic as they
enter numbers so that a pattern they can study will emerge.
TO S
WINDOW CS SETPC BLACK
SETFONT 'System' 10 1
PU SETXY [-300 -75] PD CT
PPR 'Input the side length (about 70) and press Enter,'
PPR 'then input the recursion level (a number less than 7 works
best).'
MAKE "SIDE READ
MAKE "LEVEL READ
IF :LEVEL > 2 THEN HT
CARPET :SIDE :LEVEL
CARPETFILL :SIDE :LEVEL
PU SETY -85 PD SETPC BLACK TT (SE 'level' :LEVEL) PU SETY -75 PD
CT SS PR 'Would you like to try a different recursion level? Y or N.'
MAKE "CHOICE READ
IF :CHOICE = "Y THEN RUN.IT.AGAIN ELSE CT PR 'Goodbye for now.'
TOPLEVEL
END
TO RUN.IT.AGAIN
CT ST SETPC BLACK PPR 'Enter a new recursion level.'
MAKE "LEVEL READ
IF :LEVEL > 2 THEN HT
PU RT 90 FD :SIDE + 20 PD LT 90
CARPET :SIDE :LEVEL
CARPETFILL :SIDE :LEVEL
PU SETY -85 PD SETPC BLACK TT (SE 'level' :LEVEL) PU SETY -75 PD
CT SS PR 'Would you like to try a different recursion level? Y or N.'
MAKE "CHOICE READ
IF :CHOICE = "Y THEN RUN.IT.AGAIN ELSE CT PR 'Goodbye for now.'
TOPLEVEL
END
TO CARPET :SIDE :LEVEL
IF :LEVEL < 1 [STOP]
REPEAT 4 [CARPET :SIDE / 3 :LEVEL - 1 FD :SIDE / 3 CARPET :SIDE / 3
:LEVEL - 1 FD 2 * :SIDE / 3 RT 90]
END
TO CARPETFILL :SIDE :LEVEL
IF :LEVEL < 2 [STOP]
IF :LEVEL = 2 [SETPC 9]
IF :LEVEL = 3 [SETPC 12]
IF :LEVEL = 4 [SETPC 10]
IF :LEVEL = 5 [SETPC 14]
PU RT 45 FD 2 * (:SIDE / 3) PD FILL PU BK 2 * (:SIDE / 3) LT 45
FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3 RT 90 FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3 RT 90 FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3 RT 90 FD :SIDE / 3
CARPETFILL :SIDE / 3 :LEVEL - 1
FD :SIDE / 3
FD :SIDE / 3 RT 90
CARPETFILL :SIDE / 3 :LEVEL - 1
END
John Hayes
Te Puke Primary School
NEW ZEALAND
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home