from gpanel import * from random import * iterationen = 1000000 breite = 10000 hoehe = int(sqrt(3)/2 * breite) makeGPanel("Sierpinski triangle chaos game", 0, breite, 0, hoehe) x1 = 0 y1 = 0 x2 = breite y2 = 0 x3 = int(breite / 2) y3 = hoehe x = randint(0, breite) y = randint(0, hoehe) for i in range(0, iterationen): zufall = randint(1, 3) if zufall == 1: x = (x + x1) / 2 y = (y + y1) / 2 if zufall == 2: x = (x + x2) / 2 y = (y + y2) / 2 if zufall == 3: x = (x + x3) / 2 y = (y + y3) / 2 point(int(x), int(y)) print(iterationen, "Iterationen durchgeführt.")