Algorithms, Blockchain and Cloud

LOGO Turtle Tutorial How to Draw Fractal Stars?


A ‘Fractal Graph’ can be seen as ‘self similar’. For example,

logo-fractal-stars-1 LOGO Turtle Tutorial How to Draw Fractal Stars?

logo-fractal-stars-1

This is a fractal graph that is made by LOGO turtle graphic. Each element is a tiny star and you can see the shapes of each corner are similar to the entire figure.

The idea is to draw a shape of star and in each corner of star further draw a smaller star… and this process goes on until the size of the star to draw is smaller than a threshold. The fractal graphs are often implemented in a recursive way i.e. function calls itself. The following LOGO program defines a star function that draws a star and 5 smaller stars in its five corners until the sizes of the smaller stars are too small..

cs ht
to star :size :small
    if :size<:small [stop]
    repeat 5 [fd :size star :size*0.3 :small rt 144]
end
star 200 10

We can also draw more stars in a similar way by setting to a small threshold star 200 5:

logo-fractal-stars-2

Pretty amazing, huh? This is a great example to teach your kids programming and they will learn the concepts of procedure, functional call, recursion programming and of course the concept of fractal designs!

You may also like: LOGO 海龟作图系列 – 分形五角星

–EOF (The Ultimate Computing & Technology Blog) —

340 words
Last Post: How to Check Debugger Present in Delphi?
Next Post: A Simple Msgbox Command Line Utility in Windows Batch

The Permanent URL is: LOGO Turtle Tutorial How to Draw Fractal Stars? (AMP Version)

Exit mobile version