def getStatistics(circle_x, circle_y, bar1_x, bar1_y, bar2_x, bar2_y):
out = [0, 0, 0]
midX = GLOBAL_WIDTH / 2
midY = GLOBAL_HEIGHT / 2
dx = midX - circle_x
dy = midY - circle_y
rads = atan2(-dy, dx)
rads %= 2*pi
angle = degrees(rads)
if (bar1_x - circle_x)**2 != 0:
p1Distance = sqrt((bar1_y - circle_y)**2 / (bar1_x - circle_x)**2)
if (bar2_x - circle_x)**2 != 0:
p2Distance = sqrt((bar2_y - circle_y)**2 / (bar2_x - circle_x)**2)
out[0] = angle
out[1] = p1Distance
out[2] = p2Distance
return out
#determines how to move padel based on neural net input
评论列表
文章目录