Function in Python to approximate the Sierpinski Triangle sqrt.ch --------------- def stcurve(n, step, sign, turtle): if n == 0: turtle.goForward(step) return stcurve(n - 1, step, -sign, turtle) turtle.turnAngle(sign * 60) stcurve(n - 1, step, sign, turtle) turtle.turnAngle(sign * 60) stcurve(n - 1, step, -sign, turtle) --------------- n: order or depth of the curve, for the graph shown, n = 10 step: length of the move, typically dependent on n; to obtain a graph with simple numbers, step = 1, is not the worst choice sign: ensures to have the right orientation of the curve of order n-1 turtle: can be any (of your own pets) that can move forward (step) and turn (Angle) ---------------------------------------- Normally, two functions are implemented to create this curve. This means for a «Lindenmayer System»: ---------------------------------------- ¦ Start with: F ¦ Rule: A-F-A, where A ist replaced by: ¦ Replacement-Rule: F+A+F ---------------------------------------- Instructions: F: Go Forward A: Go Forward and call Replacement-Rule -: Turn Left by 60° +: Turn Left by -60° https://www.sqrt.ch/mathematik.html#ls