Initial commit
This commit is contained in:
31
simulation/drawing.py
Normal file
31
simulation/drawing.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from turtle import *
|
||||
|
||||
def centered_circle(radius):
|
||||
"""Draws a circle, centered on the turtle's current position.
|
||||
The built-in circle function annoyingly draws a circle whose center
|
||||
is one radius left of the turtle.
|
||||
"""
|
||||
right(90)
|
||||
penup()
|
||||
forward(radius)
|
||||
pendown()
|
||||
left(90)
|
||||
circle(radius)
|
||||
left(90)
|
||||
penup()
|
||||
forward(radius)
|
||||
pendown()
|
||||
right(90)
|
||||
|
||||
def draw_boundary(distance):
|
||||
"""Draws the boundary, a square `distance` from the origin on each side.
|
||||
"""
|
||||
penup()
|
||||
goto(-distance, -distance)
|
||||
pendown()
|
||||
goto(distance, -distance)
|
||||
goto(distance, distance)
|
||||
goto(-distance, distance)
|
||||
goto(-distance, -distance)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user