Compare commits
2 commits
e415522916
...
818c88e050
Author | SHA1 | Date | |
---|---|---|---|
|
818c88e050 | ||
|
a71b8885e0 |
1 changed files with 15 additions and 7 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.05
|
||||||
###
|
###
|
||||||
|
|
||||||
# needed for erasing ol position
|
# needed for erasing ol position
|
||||||
|
@ -89,13 +94,16 @@ 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
|
||||||
x, y = ergebnis[count], ergebnis[count + 1]
|
x, y = ergebnis[count], ergebnis[count + 1]
|
||||||
curpos(x, y)
|
curpos(x, y)
|
||||||
print(cow, end="")
|
print(cow, end="")
|
||||||
|
sleep(schlafzeit)
|
||||||
curpos(xold, yold)
|
curpos(xold, yold)
|
||||||
print(".",end="")
|
print("☁️ ", end="")
|
||||||
bla = input("CR please...")
|
|
||||||
|
|
||||||
|
sys.exit(home + cow + curon)
|
||||||
|
|
Loading…
Reference in a new issue