Fehler beseitigt
This commit is contained in:
parent
e415522916
commit
a71b8885e0
1 changed files with 13 additions and 6 deletions
|
@ -17,15 +17,17 @@ def berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigk
|
||||||
jupiter = 24
|
jupiter = 24
|
||||||
gravitation = erde
|
gravitation = erde
|
||||||
startwinkel = startwinkel * deg2rad
|
startwinkel = startwinkel * deg2rad
|
||||||
cowlength = len(cow) + 1
|
if cow.isascii():
|
||||||
|
cowlength = 1
|
||||||
|
else:
|
||||||
|
cowlength = 1
|
||||||
|
|
||||||
# Calculate time of flight
|
# Calculate time of flight, actually not used
|
||||||
flugdauer = startgeschwindigkeit * sin(startwinkel) / gravitation
|
flugdauer = startgeschwindigkeit * sin(startwinkel) / gravitation
|
||||||
schlafdauer = flugdauer / xmax
|
|
||||||
# Calculate maximum height
|
# Calculate maximum height
|
||||||
hoehe = 0.5 * gravitation * flugdauer**2 + starthoehe
|
hoehe = 0.5 * gravitation * flugdauer**2 + starthoehe
|
||||||
|
|
||||||
# calculate length of flight
|
# calculate length of flight, actually not used
|
||||||
wurfweite = (
|
wurfweite = (
|
||||||
startgeschwindigkeit
|
startgeschwindigkeit
|
||||||
* cos(startwinkel)
|
* cos(startwinkel)
|
||||||
|
@ -52,6 +54,8 @@ def berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigk
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
# berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe):
|
# berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe):
|
||||||
|
|
||||||
|
# some useful control
|
||||||
|
clear, home, curoff, curon = "'\x1b[2J\x1b[H", "\x1b[H", "\x1b[?25l", "\x1b[?25h"
|
||||||
# set position of cursor
|
# set position of cursor
|
||||||
def curpos(x, y):
|
def curpos(x, y):
|
||||||
print("\033[%d;%dH" % (ymax - y, x), end="", flush=True)
|
print("\033[%d;%dH" % (ymax - y, x), end="", flush=True)
|
||||||
|
@ -79,6 +83,7 @@ xmin = 0
|
||||||
startwinkel = 34
|
startwinkel = 34
|
||||||
startgeschwindigkeit = 31
|
startgeschwindigkeit = 31
|
||||||
starthoehe = 0
|
starthoehe = 0
|
||||||
|
schlafzeit = 0.1
|
||||||
###
|
###
|
||||||
|
|
||||||
# needed for erasing ol position
|
# needed for erasing ol position
|
||||||
|
@ -89,7 +94,7 @@ y = xmin
|
||||||
|
|
||||||
# Call the function, which calculates the coordinates)
|
# Call the function, which calculates the coordinates)
|
||||||
ergebnis = berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe)
|
ergebnis = berechneflugbahn(cow, xmin, xmax, ymin, ymax, startwinkel, startgeschwindigkeit, starthoehe)
|
||||||
|
print(curoff)
|
||||||
# here we draw the cow
|
# here we draw the cow
|
||||||
for count in range(xmin, len(ergebnis), 2):
|
for count in range(xmin, len(ergebnis), 2):
|
||||||
xold, yold = x, y
|
xold, yold = x, y
|
||||||
|
@ -97,5 +102,7 @@ for count in range(xmin, len(ergebnis), 2):
|
||||||
curpos(x, y)
|
curpos(x, y)
|
||||||
print(cow, end="")
|
print(cow, end="")
|
||||||
curpos(xold, yold)
|
curpos(xold, yold)
|
||||||
print(".",end="")
|
sleep(schlafzeit)
|
||||||
|
print("☁️ ", end="")
|
||||||
bla = input("CR please...")
|
bla = input("CR please...")
|
||||||
|
sys.exit(cow+curon)
|
||||||
|
|
Loading…
Reference in a new issue