(x, y, color)
| 28 | |
| 29 | |
| 30 | def 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 | |
| 42 | def drawSierpinski(x, y, level, color): |
| 43 | if level == 0: |