tile.py tile_grid.py drawtiles.py

Yes, I'll use docstrings because I can type more comments between """ and """.
I'll still use # to the right of code to comment on the code line.
This commit is contained in:
njmason2
2025-09-12 10:48:16 -04:00
parent 22a88592cc
commit 59b8557101
2 changed files with 24 additions and 15 deletions

28
tile.py
View File

@@ -1,5 +1,6 @@
from turtle import *
# Nelson Mason - LAI 676LEC A - Assignment 1.4 - Checkpoint 3 - Draw with ranges
def draw_tile(size):
"Draws one tile, which can be repeated to form a pattern."
draw_tile_outline(size)
@@ -9,19 +10,26 @@ def draw_tile_outline(size):
pencolor("#dddddd")
square(size)
def draw_squiggle(size):
def draw_squiggle(size): # recoded to draw a circle within each square
penup()
forward(size/4)
pencolor("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/4)
left(90)
fly(size)
forward(size/2)
pendown() # new starting point for drawing inside the tile
#forward(size/4) # original starting point for drawing inside the tile
pencolor("yellow") # change of color
#left(90) part of original starting point positioning - moved up in this code block
quarter_arc_right(size/4) # 1st arc
#quarter_arc_left(size/4) not needed for right-turn drawing of circle
#quarter_arc_left(size/4) not needed for right-turn drawing of circle
quarter_arc_right(size/4) # 2nd arc
quarter_arc_right(size/4) # 3rd arc - added to keep drawing the circle
quarter_arc_right(size/4) # 4th arc - added to keep drawing the circle
left(90) # lines 28-32 moves the pen to the tile outline starting point,
fly(size/4)
left(90)
fly(size/2)
left(90) # lower left corner, pointing to the right
def fly(distance):
"Moves without drawing."