RosettaCodeData/Task/Sierpinski-triangle-Graphical/Python/sierpinski-triangle-graphical-2.py

22 lines
770 B
Python
Raw Permalink Normal View History

2018-06-22 20:57:24 +00:00
#!/usr/bin/env python
2015-02-20 00:35:01 -05:00
##########################################################################################
2018-06-22 20:57:24 +00:00
# a very complicated version
# import necessary modules
# ------------------------
from numpy import *
import turtle
2013-04-11 01:07:29 -07:00
2015-02-20 00:35:01 -05:00
##########################################################################################
2018-06-22 20:57:24 +00:00
# Functions defining the drawing actions
# (used by the function DrawSierpinskiTriangle).
# ----------------------------------------------
def Left(turn, point, fwd, angle, turt):
turt.left(angle)
return [turn, point, fwd, angle, turt]
def Right(turn, point, fwd, angle, turt):
turt.right(angle)
return [turn, point, fwd, angle, turt]
def Forward(turn, point, fwd, angle, turt):
turt.forward(fwd)
return [turn, point, fwd, angle, turt]