'''lecture_28_koch_lsystem.py Draw a Koch snowflake using an L-system Oliver W. Layton CS 151: Computational Thinking: Visual Media Spring 2021 ''' import turtle def drawString(turt, string, dist, angle): '''Have `turt` draw the L-system string, where `turt` moves forward with a distance `dist` and turns at an angle `angle` degrees ''' pass def replace(string, findStr, repStr): '''Make a new string that applies the L-system replacement rules: Replace each occurence of `findStr` in `string` with `repStr` Returns: --------- The new string with the replacement rules applied to `string` ''' pass if __name__ == '__main__': # Make a screen, turn off animations so snowflake draws fast screen = turtle.Screen() screen.setup(600, 600) screen.tracer(False) # Make a turtle turt = turtle.Turtle() # Set up L-system rules # Set up distance and angle for Koch snowflake # Apply the L-system replacement rules some number of times (iterations) # Draw the L-system screen.update() screen.exitonclick()