-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisual_helper.py
More file actions
39 lines (35 loc) · 1.4 KB
/
visual_helper.py
File metadata and controls
39 lines (35 loc) · 1.4 KB
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
38
39
import math,random
import time
Width,Height= 7000,3000
Scale = 5
Margin = 500
def transformed(string : str):
x,y = string.split()
x = float(x)//Scale
y = (3000-float(y)-300)//Scale
return (x,y,)
def absolute(string : str):
x,y = [float(x) for x in string.split()]
return math.sqrt(x*x + y*y)
def randColor():
return (random.randint(0,255),random.randint(0,255),random.randint(0,255))
# def takeInput():
# pygame.event.clear()
# pygame.display.flip()
# rotate=[float(x) for x in file.readline().strip('[]\n ,').split(',')]
# power=[float(x)*25 for x in file.readline().strip('[]\n ,').split(',')]
# velocity = tuple ([ absolute(point) for point in file.readline().strip("[], \n").split(',')] )
# position = tuple ([ transformed(point) for point in file.readline().strip("[], \n").split(',')] )
# crashIndex, cost = [int(float(x)) for x in file.readline().split()]
# pygame.draw.lines(screen,randColor(),False,position,width=2)
# pygame.draw.circle(screen,pygame.Color('white'),position[crashIndex],1)
# plt.axvline(x=crashIndex)
# font = pygame.font.Font('freesansbold.ttf', 15)
# text = font.render(str(cost), True,pygame.Color('white'))
# textRect = text.get_rect()
# screen.blit(text,position[crashIndex+4])
# plt.plot(rotate)
# plt.plot(power)
# plt.plot(velocity)
# plt.ylabel('some numbers')
# plt.savefig("plot.png")