Reconceptualized lab

This commit is contained in:
Chris Proctor
2023-07-18 17:55:04 -04:00
parent d25645282a
commit cd129bb015
6 changed files with 142 additions and 2 deletions

43
tile.py Normal file
View File

@@ -0,0 +1,43 @@
from turtle import *
def draw_tile(size):
"Draws one tile, which can be repeated to form a pattern."
color("grey")
square(size)
forward(size/2)
color("black")
left(90)
quarter_arc_right(size/4)
quarter_arc_left(size/4)
quarter_arc_left(size/4)
quarter_arc_right(size/4)
left(90)
fly(size/2)
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`"
forward(size)
left(90)
forward(size)
left(90)
forward(size)
left(90)
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)