feat: interactive trajectory

This commit is contained in:
2025-04-15 12:49:25 +03:00
parent e606b841a9
commit b8429d263f

View File

@@ -1,5 +1,6 @@
import math
import random
from time import sleep
# from scipy import
from matplotlib import pyplot as plt
@@ -26,18 +27,19 @@ class RandomPilot():
def _test():
randomPilot = RandomPilot()
point = [0, 0]
iter_count = 500
iter_count = 250
points = [point.copy()]
plt.axis([-100, 100, -100, 100])
# plt.
for i in range(iter_count):
dx, dy = randomPilot.step()
prev_point = point.copy()
point[0] += dx
point[1] += dy
points.append(point.copy())
print(*zip(*points))
plt.plot(*zip(*points), '--')
plt.show()
plt.plot(*zip(*points[-2:]), color='#5e5')
plt.pause(0.025)
sleep(1)
if __name__ == '__main__':
_test()