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:
2025-11-03 17:08:35 +01:00
parent 21a17e33fa
commit ede0ee318b
48 changed files with 1219 additions and 582 deletions

View File

@@ -3,12 +3,13 @@ import datetime
import time
#Setup
# Setup
turtle.ht()
turtle.tracer(0)
turtle.speed(0)
#Definition der Kreise
# Definition der Kreise
def circles(fill):
turtle.pu()
turtle.bk(20)
@@ -21,11 +22,13 @@ def circles(fill):
turtle.end_fill()
turtle.pu()
turtle.home()
turtle.pu()
turtle.bk(25)
#Postitionieren der Turtle
# Postitionieren der Turtle
def distance(pixels):
turtle.home()
turtle.pu()
@@ -33,17 +36,17 @@ def distance(pixels):
turtle.bk(pixels)
turtle.rt(90)
#Berechnen der einzelnen Stellen
# Berechnen der einzelnen Stellen
def main():
turtle.clear()
turtle.home()
h = datetime.datetime.now().hour
min = datetime.datetime.now().minute
sec = datetime.datetime.now().second
hr_pos2 = h//2
mn_pos2 = min//2
sk_pos2 = sec//2
hr_pos2 = h // 2
mn_pos2 = min // 2
sk_pos2 = sec // 2
for i in range(6):
hr_pos2 = hr_pos2 // 2
@@ -63,10 +66,11 @@ def main():
sk_pos2 = sk_pos2 // 2
sk_pos = sk_pos2 % 2
circles(sk_pos)
turtle.update()
#Ausführen
# Ausführen
while True:
main()
time.sleep(0.1)
time.sleep(0.1)

View File

@@ -1,11 +1,11 @@
from turtle import*
from turtle import *
import datetime
import time
style = ("Minecraftia", 75, "normal")
tracer(0)
#Ausführen der Uhr.
# Ausführen der Uhr.
while True:
time.sleep(1)
clear()
@@ -15,7 +15,7 @@ while True:
min = datetime.datetime.now().minute
h = datetime.datetime.now().hour
bk(350)
#Abstände definieren
# Abstände definieren
if h >= 10:
write(h, font=style)
fd(200)
@@ -24,7 +24,7 @@ while True:
fd(100)
write(h, font=style)
fd(100)
write(":", font=style, align = "left")
write(":", font=style, align="left")
fd(50)
if min >= 10:
write(min, font=style)
@@ -34,7 +34,7 @@ while True:
fd(100)
write(min, font=style)
fd(100)
write(":", font=style, align = "left")
write(":", font=style, align="left")
fd(50)
if sec >= 10:
write(sec, font=style)
@@ -45,4 +45,4 @@ while True:
write(sec, font=style)
fd(100)
home()
update()
update()

View File

@@ -1,10 +1,11 @@
from turtle import*
from turtle import *
import time
def scene(d):
dot(500/d)
dot(500 / d)
ht()
color("red")
bgcolor("black")
@@ -22,4 +23,4 @@ for i in range(200):
update()
a -= 1
time.sleep(0.025)
fd(1)
fd(1)

View File

@@ -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()

View File

@@ -1,14 +1,14 @@
from turtle import*
from turtle import *
speed(10000)
ht()
def kreis_halb(anzahl_seiten, radius):
for i in range(anzahl_seiten):
fd(radius / anzahl_seiten)
rt(360 / anzahl_seiten)
def kreis_halb(anzahl_seiten,radius):
for i in range(anzahl_seiten):
fd(radius / anzahl_seiten)
rt(360 / anzahl_seiten)
kreis_halb(500,800)
kreis_halb(500, 800)
exitonclick()

View File

@@ -9,7 +9,9 @@ sideby = int(turtle.numinput("Huhn", "Punkt B, cord y", -100))
sidebx = int(turtle.numinput("Huhn", "Punkt B, cord x", -200))
sidecy = int(turtle.numinput("Huhn", "Punkt C, cord y", 200))
sidecx = int(turtle.numinput("Huhn", "Punkt C, cord x", 0))
anzahl_durchgaenge = int(turtle.numinput("Huhn", "Anzahl Durchgänge", 10, minval=1, maxval=100))
anzahl_durchgaenge = int(
turtle.numinput("Huhn", "Anzahl Durchgänge", 10, minval=1, maxval=100)
)
stiftdicke = int(turtle.numinput("Huhn", "Stiftdicke", 2, minval=1, maxval=50))
durchgang = 0
@@ -23,8 +25,8 @@ huhn.pu()
huhn.ht()
def motion(sideay,sideax,sideby,sidebx,sidecy,sidecx,stiftdicke):
edge = random.randint(1,3)
def motion(sideay, sideax, sideby, sidebx, sidecy, sidecx, stiftdicke):
edge = random.randint(1, 3)
if edge == 1:
x = sideax
y = sideay
@@ -35,16 +37,17 @@ def motion(sideay,sideax,sideby,sidebx,sidecy,sidecx,stiftdicke):
else:
x = sidecx
y = sidecy
huhn.setheading(huhn.towards(x, y))
nextpos = (math.sqrt((x - huhn.xcor())**2 + (y - huhn.ycor()) **2)) / 2
nextpos = (math.sqrt((x - huhn.xcor()) ** 2 + (y - huhn.ycor()) ** 2)) / 2
huhn.fd(nextpos)
huhn.pd()
huhn.dot(stiftdicke)
huhn.pu()
def motion_pre(sideay,sideax,sideby,sidebx,sidecy,sidecx,stiftdicke):
edge = random.randint(1,3)
def motion_pre(sideay, sideax, sideby, sidebx, sidecy, sidecx, stiftdicke):
edge = random.randint(1, 3)
if edge == 1:
x = sideax
y = sideay
@@ -55,33 +58,34 @@ def motion_pre(sideay,sideax,sideby,sidebx,sidecy,sidecx,stiftdicke):
else:
x = sidecx
y = sidecy
huhn.setheading(huhn.towards(x, y))
nextpos = (math.sqrt((x - huhn.xcor())**2 + (y - huhn.ycor()) **2)) / 2
nextpos = (math.sqrt((x - huhn.xcor()) ** 2 + (y - huhn.ycor()) ** 2)) / 2
huhn.fd(nextpos)
def cagedraw(sideax,sideay,sidebx,sideby,sidecx,sidecy):
def cagedraw(sideax, sideay, sidebx, sideby, sidecx, sidecy):
cage.pu()
cage.setpos(sideax,sideay)
cage.setpos(sideax, sideay)
cage.pd()
cage.setpos(sidebx,sideby)
cage.setpos(sidecx,sidecy)
cage.setpos(sideax,sideay)
cage.setpos(sidebx, sideby)
cage.setpos(sidecx, sidecy)
cage.setpos(sideax, sideay)
print("Started drawing Triangle")
cagedraw(sideax,sideay,sidebx,sideby,sidecx,sidecy)
cagedraw(sideax, sideay, sidebx, sideby, sidecx, sidecy)
print("Started mapping... Printing Points of Tranche:")
turtle.tracer(1000)
print("initialisation")
for i in range(50):
motion_pre(sideay,sideax,sideby,sidebx,sidecy,sidecx,stiftdicke)
motion_pre(sideay, sideax, sideby, sidebx, sidecy, sidecx, stiftdicke)
for i in range(anzahl_durchgaenge):
for i in range(1000):
motion(sideay,sideax,sideby,sidebx,sidecy,sidecx,stiftdicke)
motion(sideay, sideax, sideby, sidebx, sidecy, sidecx, stiftdicke)
durchgang += 1
print(durchgang,"/", anzahl_durchgaenge)
print(durchgang, "/", anzahl_durchgaenge)
print("done, click to exit")
turtle.exitonclick()
turtle.exitonclick()

View File

@@ -1,17 +1,19 @@
from turtle import*
from turtle import *
speed(1000)
def blatt(seite,winkel,anzahl):
def blatt(seite, winkel, anzahl):
for i in range(anzahl):
begin_fill()
for i in range(3):
fd(seite)
lt(winkel)
end_fill()
rt(360/anzahl)
rt(360 / anzahl)
ht()
color("green")
blatt(100,120,4)
exitonclick()
blatt(100, 120, 4)
exitonclick()

View File

@@ -4,14 +4,15 @@ import time
turtle.pu()
def vieleck_random_randomize():
for i in range(random.randint(25, 100)):
turtle.color(random.random(),random.random(),random.random())
turtle.color(random.random(), random.random(), random.random())
size = random.randint(50, 200)
turtle.width(random.randint(2, 10))
ecken = random.randint(3, 20)
turtle.setpos(random.randint(-300,300), random.randint(-300,300))
fuellen = random.randint(0,1)
turtle.setpos(random.randint(-300, 300), random.randint(-300, 300))
fuellen = random.randint(0, 1)
turtle.pd()
if fuellen >= 1:
turtle.begin_fill()
@@ -24,12 +25,13 @@ def vieleck_random_randomize():
turtle.fd(size / ecken)
turtle.rt(360 / ecken)
turtle.pu()
print("Random Design")
draw_time_start = time.time()
vieleck_random_randomize()
draw_time_end = time.time()
print("Drawing has taken", draw_time_end - draw_time_start , "seconds")
print("Drawing has taken", draw_time_end - draw_time_start, "seconds")
print("Click to exit")
turtle.exitonclick();
turtle.exitonclick()

View File

@@ -3,9 +3,9 @@ import os
while True:
for i in range(4):
print("=", end=" ",flush=True)
print("=", end=" ", flush=True)
time.sleep(0.5)
print("=", end="\r",flush=True)
print("=", end="\r", flush=True)
time.sleep(0.5)
os.system("cls")
time.sleep(0.5)
os.system( 'cls' )
time.sleep(0.5)

View File

@@ -1,4 +1,4 @@
from turtle import*
from turtle import *
dicke = 3
lt(90)
@@ -13,4 +13,3 @@ for i in range(10):
lt(90)
width(dicke)
dicke += 2

View File

@@ -1,7 +1,9 @@
from turtle import*
from turtle import *
a = int(numinput("Wie alt bist du?", "Bitte als Zahl eingeben",16,minval=1,maxval=100))
a = int(
numinput("Wie alt bist du?", "Bitte als Zahl eingeben", 16, minval=1, maxval=100)
)
while (a>=16) and (a<=20):
while (a >= 16) and (a <= 20):
fd(100)
a = 1
a = 1

View File

@@ -1,10 +1,10 @@
#TICTACTOE V 1.0
# TICTACTOE V 1.0
import time
#Variables5
# Variables5
global bd
bd = [[0,0,0],[0,0,0],[0,0,0]]
bd = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
global filled_fields
filled_fields = 0
global player
@@ -15,8 +15,8 @@ global play
play = 1
#FUNCTIONS
#--------------------
# FUNCTIONS
# --------------------
def inputs():
global playershow
global bd
@@ -28,17 +28,22 @@ def inputs():
z = int(zl) - 1
s = ord(sp) - 65
if bd[z][s] > 0:
print("""
print(
"""
THAT FIELD IS ALREADY TAKEN, CHOOSE DIFFERENT ONE!
""")
"""
)
else:
inputremap(z,s)
inputremap(z, s)
else:
print("""
print(
"""
PLEASE TYPE IN A LEGIT COORDINATE:
FORM: Coordinate Y Coordinate X --> Ex. A1/A2
""")
"""
)
def inputremap(z, s):
global player
global playershow
@@ -51,9 +56,9 @@ def inputremap(z, s):
playershow = 1
player = 1
global filled_fields
filled_fields += 1
filled_fields += 1
full(filled_fields)
def winning():
global play
@@ -63,9 +68,11 @@ def winning():
global go
go = 1
count = 0
print("""
print(
"""
checking for winner
""")
"""
)
while go == 1:
if sum(bd[x]) == 3:
go = 0
@@ -88,11 +95,14 @@ checking for winner
y += 1
if count >= 2:
go = 0
print("""no winner yet
""")
print(
"""no winner yet
"""
)
else:
count += 1
def full(filled_field):
global bd
if filled_field == 9:
@@ -103,7 +113,7 @@ def full(filled_field):
winning()
#BOARD DRAWING
# BOARD DRAWING
def board_draw():
print("\n")
xx = 0
@@ -112,17 +122,17 @@ def board_draw():
while yy < 3:
while xx < 3:
if bd[xx][yy] == 0:
print(" ", end = " ")
print(" ", end=" ")
elif bd[xx][yy] == 1:
print(" X ", end = " ")
print(" X ", end=" ")
elif bd[xx][yy] == 7:
print(" O ", end = " ")
print(" O ", end=" ")
else:
print(""" CRITICAL ERROR""")
if xx < 2:
print("|", end = " ")
print("|", end=" ")
else:
print(" ", end = " ")
print(" ", end=" ")
xx += 1
print(" ")
xx = 0
@@ -131,14 +141,13 @@ def board_draw():
else:
print(" ")
yy += 1
#MAIN CYCLE
print(50*("\n"))
print("""
# MAIN CYCLE
print(50 * ("\n"))
print(
"""
------------------------------------------------------
@@ -153,35 +162,42 @@ print("""
by Janis Hutz
""")
"""
)
time.sleep(2)
print("starting...")
time.sleep(3)
print("\n\n\n")
goahead = 1
print("""
print(
"""
| |
----------------
| |
----------------
| |
""")
"""
)
while goahead == 1:
while play == 1:
inputs()
board_draw()
time.sleep(2)
print("""
print(
"""
REPLAY?
""")
"""
)
i = input("""Choose: (y/n)""")
if i == "y":
goahead = 1
play = 1
else:
goahead = 0
print("""
print(
"""
GOOD BYE!
""")
"""
)

View File

@@ -1,9 +1,10 @@
from turtle import*
from turtle import *
lt(90)
width(3)
speed(1000)
def stiel(orientation):
color("green")
for i in range(50):
@@ -13,31 +14,29 @@ def stiel(orientation):
else:
fd(7)
rt(1)
def leaves():
color("red")
for i in range(100):
fd(3)
rt(360/100)
def blume(orientation_in,blaetter):
rt(360 / 100)
def blume(orientation_in, blaetter):
stiel(orientation_in)
for i in range(blaetter):
leaves()
rt(360/blaetter)
rt(360 / blaetter)
ht()
blume(2,5)
blume(2, 5)
pu()
home()
fd(50)
lt(90)
pd()
blume(1,10)
exitonclick()
blume(1, 10)
exitonclick()