Format
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
This commit is contained in:
@@ -1,36 +1,39 @@
|
||||
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)
|
||||
|
||||
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
|
||||
# ausgefülltes Pentagon zeichnen
|
||||
color("Red")
|
||||
begin_fill()
|
||||
for i in range(5):
|
||||
fd(radius)
|
||||
rt(360/5)
|
||||
end_fill()
|
||||
rt(360 / 5)
|
||||
end_fill()
|
||||
else:
|
||||
for i in range(5):
|
||||
#Positionierung der Turtle
|
||||
# Positionierung der Turtle
|
||||
pu()
|
||||
fd(radius * 2.62 * 0.381966)
|
||||
rt(360/5)
|
||||
rt(360 / 5)
|
||||
pd()
|
||||
#Rekursion
|
||||
pentagon(n - 1,radius * 0.381966)
|
||||
# Rekursion
|
||||
pentagon(n - 1, radius * 0.381966)
|
||||
update()
|
||||
|
||||
|
||||
starttime = time.time()
|
||||
pu()
|
||||
lt(90)
|
||||
fd(r)
|
||||
rt(90)
|
||||
bk(r*0.6)
|
||||
bk(r * 0.6)
|
||||
pd()
|
||||
pentagon(rl, r)
|
||||
|
||||
exitonclick();
|
||||
exitonclick()
|
||||
|
||||
Reference in New Issue
Block a user