Files
lab_iteration/tile.py
Heather 438ca9f024 For Checkpoint 3 I added in the coordinates used for the
code. To me, this provided more information for thereader.

I thinkI would use docstrings. They are helpful because they put what the code does info
"laymans" terms.
2025-10-04 17:52:01 -04:00

51 lines
1.0 KiB
Python

from turtle import *
def draw_tile(size):
"Draws one tile, which can be repeated to form a pattern."
draw_tile_outline(size)
draw_squiggle(size)
draw_triangle(size)
def draw_tile_outline(size):
pencolor("#dddddd")
square(size)
def draw_triangle(size):
for i in range(3):
forward(size)
left(360//3)
def draw_squiggle(size):
forward(size/4)
pencolor("green")
left(80)
quarter_arc_right(size/4)
quarter_arc_left(size/4)
quarter_arc_left(size/4)
quarter_arc_right(size/4)
left(90)
fly(size/4)
left(90)
fly(size)
left(90)
def fly(distance):
"Moves without drawing."
penup()
forward(distance)
pendown()
def square(size):
"Draws a square of side length `size`"
for side in range(4):
forward(size)
left(90)
def quarter_arc_right(radius):
"Draws a quarter of an arc, turning to the right."
circle(-radius, 90)
def quarter_arc_left(radius):
"Draws a quarter of an arc, turning to the left."
circle(radius, 90)