Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
n_lines = 50
n_col = 100
print(" "+n_col*"-")
lineId = 0
while lineId < n_lines:
colId = 0
txt_to_print = "|"
while colId < n_col:
t = 0
filled = False
while t < 10000: # On évalue toute la trajectoire pour chaque case du tableau...
x = v0_x*t
y = v0_y*t - 0.5*g*t**2
t+=0.01
if abs(x - colId ) < 0.5 and abs(n_lines-y-lineId)<0.5:
txt_to_print+="x"
filled = True
break
if y < 0 or x < 0 or x > n_col:
break
if filled == False:
txt_to_print += " "
colId+=1
lineId+=1