generated from mwc/lab_iteration
I completed checkpoint 3
I do think I will write doctrings because it will help me to easily remember what a line of code means without having to dissect it. This will lead to easier implementation of each code.
This commit is contained in:
parent
59a3a3b2d8
commit
ac1f95404b
Binary file not shown.
Binary file not shown.
10
tile.py
10
tile.py
|
@ -10,15 +10,15 @@ def draw_tile_outline(size):
|
|||
square(size)
|
||||
|
||||
def draw_squiggle(size):
|
||||
forward(size/4)
|
||||
forward(3*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)
|
||||
quarter_arc_right(size/4)
|
||||
quarter_arc_left(size/4)
|
||||
left(90)
|
||||
fly(size/4)
|
||||
fly(3*size/4)
|
||||
left(90)
|
||||
fly(size)
|
||||
left(90)
|
||||
|
@ -42,3 +42,5 @@ def quarter_arc_right(radius):
|
|||
def quarter_arc_left(radius):
|
||||
"Draws a quarter of an arc, turning to the left."
|
||||
circle(radius, 90)
|
||||
|
||||
input()
|
13
tile_grid.py
13
tile_grid.py
|
@ -10,7 +10,15 @@ 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.)
|
||||
(draw tile grid creates a grid where width represents how many tiles wide,
|
||||
heigh represents how many tiles high, tile_size represents the length of 1 side
|
||||
of the tile, and tile_function represents what is drawn inside the tile like draw_squiggle
|
||||
from tile.py. The function will draw 1 tile then fly the length of tile_size to move
|
||||
on to draw the next tile. Then it will return to the beginning of the row by flying
|
||||
backwards the length of each tile side time the number of tiles in the width. Then the
|
||||
function will move up to draw the next row by turning and flying to reset. This will
|
||||
repeat for as many times as the height calls for. At the very end the cursor will move
|
||||
back to the very beginning by turning and flying the tile_size times the height.)
|
||||
"""
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
|
@ -36,7 +44,8 @@ def move_up_one_row(tile_size):
|
|||
fly(tile_size)
|
||||
right(90)
|
||||
|
||||
|
||||
|
||||
done()
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue