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_design(size) def draw_tile_outline(size): pencolor("#dddddd") square(size) def draw_design(size): forward(size/2) pencolor("black") 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." 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)