Files
inf-kswo/RandomOtherStuff/While_rekursion.py
Janis Hutz ede0ee318b 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
2025-11-03 17:08:35 +01:00

54 lines
1.1 KiB
Python
Executable File

# No, there is not in fact any recursion here
from turtle import *
t1 = Turtle()
t2 = Turtle()
go = 3
t1.lt(90)
t1.speed(1000)
t1.ht()
def gogo():
go = 2
while go > 1:
if t1.xcor() < (window_width() / 2 - 50):
for i in range(50):
t1.fd(2)
t1.rt(180 / 50)
if t1.xcor() < (window_width() / 2 - 50):
for i in range(50):
t1.fd(2)
t1.lt(180 / 50)
else:
print("done")
print(xcor())
go = 1
while go > 0 and go < 2:
if t1.xcor() > (window_width() / 2 - window_width() / 2 + 50):
for i in range(50):
t1.bk(2)
t1.lt(180 / 50)
if t1.xcor() > (window_width() / 2 - window_width() / 2 + 50):
for i in range(50):
t1.bk(2)
t1.rt(180 / 50)
else:
print("home")
go = 0
onkey(gogo, "space")
print("ready")
t2.ht()
onkey(gogo, "space")
listen()
print("ready")