kleinigkeiten korrigiert
This commit is contained in:
parent
d4eb22f246
commit
63d7fa486f
1 changed files with 29 additions and 16 deletions
|
@ -37,20 +37,26 @@ clear, home, curoff, curon = "'\x1b[2J\x1b[H", "\x1b[H", "\x1b[?25l", "\x1b[?25h
|
|||
xsteps = xmax
|
||||
x = 0
|
||||
y = x**2
|
||||
starthoehe = 0
|
||||
startwinkel = 45
|
||||
startgeschwindigkeit = 23
|
||||
erde = 9.81
|
||||
mond = 1.6
|
||||
jupiter = 24
|
||||
gravitation = erde
|
||||
# in scala the resulting coordinates will be returned
|
||||
scala = []
|
||||
|
||||
# used, if input is disabled
|
||||
starthoehe = 0
|
||||
startwinkel = 26
|
||||
startgeschwindigkeit = 23
|
||||
loeschen = "n"
|
||||
|
||||
#########################
|
||||
starthoehe = float(input("Starthöhe: "))
|
||||
startwinkel = float(input("Startwinkel: ")) * deg2rad
|
||||
startgeschwindigkeit = float(input("Startgeschwindigkeit: "))
|
||||
|
||||
# Be a friendly host, lets have a talk.
|
||||
# comment out to speed up testing
|
||||
starthoehe = float(input("Starthöhe in Metern, empf: 0-20: "))
|
||||
startwinkel = float(input("Startwinkel 0° - 90°: ")) * deg2rad
|
||||
startgeschwindigkeit = float(input("Startgeschwindigkeit Meter (zb 20) pro Sekunde: "))
|
||||
loeschen = input("Kuh löschen? (y/n)")
|
||||
####
|
||||
|
||||
# Calculate time of flight
|
||||
flugdauer = startgeschwindigkeit * sin(startwinkel) / gravitation
|
||||
|
@ -75,31 +81,38 @@ print(
|
|||
"\nwurfweite: ",
|
||||
wurfweite,
|
||||
"\nstartwinkel: ",
|
||||
startwinkel,
|
||||
startwinkel / deg2rad,
|
||||
"\nstartgeschwindigkeit: ",
|
||||
startgeschwindigkeit,
|
||||
"\nstarthroehe: ",
|
||||
"\nstarthoehe: ",
|
||||
starthoehe,
|
||||
"hoehe: ",
|
||||
"\nhoehe: ",
|
||||
hoehe,
|
||||
)
|
||||
|
||||
a = input("CR please:")
|
||||
bla = input("CR please:")
|
||||
|
||||
# position cursor down left corner
|
||||
curpos(1, ymax)
|
||||
|
||||
# cowlenght ist 2, is cow is an UTF8-Icon, otherwise 1
|
||||
# cowlength is 2, if cow is an UTF8-Icon, otherwise 1
|
||||
for x in range(1, xsteps, cowlength):
|
||||
# the formula, which genereates the y position for the corresponding x
|
||||
# the formula, which generates the y position for the corresponding x, shamelessly ripped from some schoolbook and modified.
|
||||
yold = y
|
||||
y = (-(gravitation / (2 * startgeschwindigkeit**2 * cos(startwinkel) ** 2)) * x**2) + (tan(startwinkel) * x + starthoehe)
|
||||
|
||||
# Ensure, that nothing has to be drawn outside the viewport
|
||||
if y < ymax and y > ymin:
|
||||
curpos(x, y)
|
||||
print(cow, end="")
|
||||
time.sleep(0.01)
|
||||
# Stash awa the coordinates into scala, which will be returned
|
||||
scala += [x, int(y * 10 + 5) / 10]
|
||||
time.sleep(0.03)
|
||||
if loeschen == "y":
|
||||
curpos(x - 2, yold)
|
||||
print(" ", end="")
|
||||
|
||||
|
||||
curpos(1, 1)
|
||||
curpos(0, 0)
|
||||
# print(scala)
|
||||
sys.exit(curon + "Moooooooooooo.")
|
||||
|
|
Loading…
Reference in a new issue