diff --git a/__pycache__/tile.cpython-310.pyc b/__pycache__/tile.cpython-310.pyc new file mode 100644 index 0000000..d6e1e65 Binary files /dev/null and b/__pycache__/tile.cpython-310.pyc differ diff --git a/__pycache__/tile_grid.cpython-310.pyc b/__pycache__/tile_grid.cpython-310.pyc new file mode 100644 index 0000000..27857ab Binary files /dev/null and b/__pycache__/tile_grid.cpython-310.pyc differ diff --git a/tile.py b/tile.py index 697cf8e..5271194 100644 --- a/tile.py +++ b/tile.py @@ -1,27 +1,26 @@ from turtle import * +import math def draw_tile(size): "Draws one tile, which can be repeated to form a pattern." draw_tile_outline(size) - draw_squiggle(size) + draw_design(size) def draw_tile_outline(size): pencolor("#dddddd") square(size) -def draw_squiggle(size): - forward(size/4) +def draw_design(size): + forward(size/2) 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) - left(90) + fillcolor("black") + left(45) + begin_fill() + square(math.sqrt(2 * ((size / 2) ** 2))) + end_fill() + left(135) + fly(size/2) + left(180) def fly(distance): "Moves without drawing." diff --git a/tile_grid.py b/tile_grid.py index 72a0f43..f2cfab6 100644 --- a/tile_grid.py +++ b/tile_grid.py @@ -10,7 +10,12 @@ from tile import fly def draw_tile_grid(width, height, tile_size, tile_function): """Draws a (width x height) grid, with tile_function drawn on each tile. - (Your explanation here.) + The inner-loop draws each tile to fill out a row, after which the turtle goes + back to the beginning of the row and then moves up to begin filling out the + next row (the outer-loop controls how many times to shift up in the overall + grid), continuing this build-row-then-shift process until the complete + grid has been created. The turtle finishes the process back in the lower-left + corner of the grid that it created. """ for y in range(height): for x in range(width):