Newer
Older
import math
v0 = float(input("Vitesse initiale ?"))
alpha = float(input("Angle initial ?"))
v0_x = v0*math.cos(alpha*math.pi/180)
v0_y = v0*math.sin(alpha*math.pi/180)
g = 9.81
# Paramètres A et B tels que y = A*x + B*x²
A = v0_y / v0_x
B = 0.5*g/v0_x**2
n_lines = 50
n_col = 100
print(" "+n_col*"-")
lineId = 0
while lineId < n_lines:
colId = 0
txt_to_print = "|"
while colId < n_col:
filled = False
x = colId - 0.5
while x < colId + 0.5: # Boucle sur x pour avoir une ligne continue
y = A*x - B*x**2
if abs(n_lines-y-lineId)<0.5:
filled = True # S'assurer qu'on ne remplisse qu'une fois une case
txt_to_print+="x"
break
x+=0.1
if not filled:
txt_to_print += " " # Case non remplie
colId+=1
lineId+=1