MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / drawTriangle

Function drawTriangle

src/gamesbyexample/sierpinskitriangle.py:30–40  ·  view source on GitHub ↗
(x, y, color)

Source from the content-addressed store, hash-verified

28
29
30def drawTriangle(x, y, color):
31 turtle.penup()
32 turtle.pencolor(color)
33 turtle.goto(x, y) # Go to bottom-left corner of the triangle.
34 turtle.pendown()
35 turtle.setheading(60)
36 turtle.forward(BASE_SIZE) # Draw first side.
37 turtle.right(120)
38 turtle.forward(BASE_SIZE) # Draw second side.
39 turtle.right(120)
40 turtle.forward(BASE_SIZE) # Draw third side.
41
42def drawSierpinski(x, y, level, color):
43 if level == 0:

Callers 1

drawSierpinskiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected