There really is no hope of making this code even half-way decent without spending the time to rewrite them all properly. Don't want to do any of that
40 lines
817 B
Python
Executable File
40 lines
817 B
Python
Executable File
from turtle import *
|
|
import time
|
|
|
|
r = numinput("PENTAGON", "Wie gross soll die Seitenlänge des Pentagons sein?", 200)
|
|
rl = numinput("PENTAGON", "Wie viele Ebenen sollen benuzt werden?", 3)
|
|
tracer(0)
|
|
|
|
|
|
def pentagon(n, radius):
|
|
if n == 0:
|
|
# ausgefülltes Pentagon zeichnen
|
|
color("Red")
|
|
begin_fill()
|
|
for i in range(5):
|
|
fd(radius)
|
|
rt(360 / 5)
|
|
end_fill()
|
|
else:
|
|
for i in range(5):
|
|
# Positionierung der Turtle
|
|
pu()
|
|
fd(radius * 2.62 * 0.381966)
|
|
rt(360 / 5)
|
|
pd()
|
|
# Rekursion
|
|
pentagon(n - 1, radius * 0.381966)
|
|
update()
|
|
|
|
|
|
starttime = time.time()
|
|
pu()
|
|
lt(90)
|
|
fd(r)
|
|
rt(90)
|
|
bk(r * 0.6)
|
|
pd()
|
|
pentagon(rl, r)
|
|
|
|
exitonclick()
|