Lesson goal: Turtle Fractals and Recursive Curves

Previous: Turtle Graphics and Logo Drawing | Home | Next: The Cartesian Coordinate System

Fractals are geometric patterns that repeat at smaller scales through self-similarity. In programming, we create them using recursion—a function that calls itself with smaller inputs until reaching a base case (when order == 0, draw a straight line).

The Koch Snowflake replaces the middle third of each line segment with an equilateral triangle bump (turning left $60^\circ$, right $120^\circ$, left $60^\circ$). At each step the perimeter grows by $4/3$, yielding an infinite perimeter enclosed within a finite area!

Now you try. Change the recursion order from 3 to 2 or 4, or change the turn angles inside the recursive step to see new geometric fractals emerge!

Type your code here:


See your results here: