import numpy as np
import matplotlib.pyplot as plt


bottom = 8
max_height = 4
radii = np.load("C:/Users/evolj/Documents/GitHub/Temporary-CS229-pool/src/utils/brute_force_logs.npy",allow_pickle=True)
radii=radii[:,2].reshape(360*2,4)[:,3]+2
print(radii)
N = len(radii)
theta = np.linspace(np.pi, 3 * np.pi, N, endpoint=False)
width = (2*np.pi) / N

ax = plt.subplot(111, polar=True)
bars = ax.bar(theta, radii, width=width, bottom=bottom)

# Use custom colors and opacity
for r, bar in zip(radii, bars):
    bar.set_facecolor(plt.cm.jet(r / 10.))
    bar.set_alpha(0.8)

plt.savefig('C:/Users/evolj/Documents/GitHub/Temporary-CS229-pool/demo3.png', transparent=True)
plt.show()

#cords=np.load("positions.npy")
#print(cords)
#plt.scatter(cords[:,0],cords[:,1])
#plt.savefig('C:/Users/evolj/Documents/GitHub/Temporary-CS229-pool/reachable_points.png', transparent=True)
#plt.show()

k=[-38,-21,47,-43,-28,-37,-23,-31,-40,-29,-39,-27,35,-26,-26,-27,-22,-32,-34,-27,-25,-19,-33,-34,-37,-32,-26,-33,-37,-30,-22,-31,-31,-29,-28,-37,-40,-24,-39,-32,-39,-59,-25,-37,-28,-27,19,-20,-36,-38,-38,-31,-34,-38,-32,-32,-26,-50,-28,-30,24,-41,-30,-22,-38,-33,-23,-42,-27,-24,-22,-26,-34,-36,-49,-25,-27,-37,-29,-35,16,-22,-33,-27,-32,-41,-36,-25,-39,-34,-24,-33,-33,-22,-42,-27,-26,-29,-33,-28,-28,-27,-32,-32,-42,-29,-26,-36,-33,-28,-33,39,-28,-38,-33,-28,-26,-27,34,-27,-27,-37,41,-27,-31,-26,-41,35,-37,-20,-25,-31,-33,-26,-32,-28,-22,-34,22,-22,-42,-31,-32,-33,-23,-27,-34,-33,-34,-39,-38,-33,-26,-39,-28,-24,-29,-28,-32,-33,-29,-27,-34,-31,-43,-27,-28,-23,-29,-37,-27,-27,-26,-37,-33,-33,-21,-27,-37,-22,-26,-29,-36,-27,-28,-29,-28,-22,-34,-27,-41,-30,-34,-27,-24,-24,-24,-27,-37,-26,-27,43,-28,-27,48,48,-28,40,-32,32,-31,-28,-27,-28,-31,-26,-33,-27,-33,-31,-28,-37,-32,-31,-20,-26,-21,-31,-22,-27,-37,-22,-22,-28,-26,47,-22,-20,-24,-27,-22,-22,-32,-19,-27,-22,-21,-26,-26,-26,-35,-28,-27,-31,-22,-32,-21,-22,-32,-26,-26,-18,-26,-27,-27,-24,-26,-22,-27,-20,-29,-31,-24,-31,45,47,47,47,-31,-21,-29,-25,33,-31,-27,-29,-27,-26,-27,-20,-27,-20,-25,-19,-32,-24,-25,-26,-23,-21,-21,-28,-28,-22,-33,-23,-22,-27,-28,-22,-27,-22,-31,44,-27,-22,-26,-30,-26,-24,-18,-24,-28,-27,-23,-26,-23,-25,-27,-26,-33,-31,-27,-32,-26,-28,-37,-27,-22,-28,-22,-28,-25,-28,47,-33,-23,-26,-27,-21,28,-35,-31,-23,-32,-27,-31,-21,-29,-27,-34,-26,-27,-37,-25,-20,-29,-38,-27,-36,-28,-23,-27,-28,-27,-38,-23,-27,-28,-22,-32,-32,-29,-27,-22,-32,-21,-28,-23,-26,-27,-32,-33,-31,-25,24,41,-28,-31,-31,-33,-33,-28,-28,-28,-28,-30,-28,-31,-27,-33,-23,-28,-19,-27,-25,-24,-26,-25,-23,-27,-28,-22,46,-33,-23,-27,-21,-30,-32,-22,-38,-23,-28,-26,-36,-37,35,-27,-32,-28,-26,-36,-33,-26,-31,-25,-38,-32,-33,-31,-24,-36,-28,-31,-33,-22,-37,26,-28,-26,-32,-35,-28,-33,-25,-23,-32,-26,-27,-30,27,-26,-32,-25,-26,-32,-37,-28,-27,-28,-22,-28,-27,-23,-23,-27,-23,-25,-32,-31,-26,-28,-33,-28,-25,-23,-28,-28,-33,-28,-28,-28,-38,-23,-28,-28,-28,-23,-33,-28,39,-27,-23,-32,-25,-28,-27,-21,-33,-28,-28,-28,-24,-23,-33,48,-33,-25,33,36,-27,49,46,-28,-32,45,-25,47,-31,-33,-27,47,-32,38,45,45,45,45,45,45,-26,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,37,44,45,45,45,45,45,45,45,-30,45,45,45,45,45,45,45,45,-22,45,45,45,-33,45,45,45,45,45,45,45,45,45,-34,-29,45,45,45,45,45,-25,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,-37,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-22,45,45,45,-23,49,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,-21,39,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-27,45,45,45,-25,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-30,45,45,45,46,45,-34,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,44,45,45,45,45,45,45,-29,45,-28,45,45,45,45,45,45,41,45,45,45,45,45,46,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,43,-32,45,45,45,43,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,43,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-30,45,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,41,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-27,45,45,44,45,28,45,45,-32,45,45,45,45,-21,45,45,45,45,45,45,45,45,45,45,46,45,-31,45,45,45,23,45,45,45,-14,45,-31,45,45,45,45,45,45,45,45,45,-30,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,47,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,40,45,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-22,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,43,-27,45,45,45,45,45,45,45,45,35,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,-36,45,45,45,45,45,45,45,45,45,-25,45,45,45,48,45,45,45,45,39,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-22,45,45,45,45,45,45,-25,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,36,45,45,45,45,45,45,45,45,45,-27,-23,41,45,-21,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,39,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-22,-35,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-20,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,45,45,45,45,45,45,45,45,45,45,45,45,43,45,45,45,45,45,45,45,45,45,45,45,42,-38,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,47,45,45,43,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,44,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-33,45,45,45,45,45,45,45,45,45,45,45,41,45,45,45,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,45,45,45,-25,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-21,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-31,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-36,45,45,45,45,45,45,45,45,-26,45,45,-23,40,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,23,45,-24,45,44,45,45,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,-27,45,-28,45,45,-28,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-36,45,45,-32,45,45,45,45,41,45,45,45,45,45,45,45,45,45,45,44,45,45,45,-25,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-22,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,31,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,34,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-31,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,43,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,-25,45,45,45,45,44,-36,45,45,45,45,45,45,45,41,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,-23,-39,45,-24,-33,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,-32,45,45,45,-21,-28,45,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-25,45,45,45,45,45,45,45,45,45,45,45,45,45,45,39,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,-20,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-33,45,45,45,45,45,44,-27,45,45,45,36,45,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-31,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,45,45,45,41,45,45,45,45,-22,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,-32,45,45,-28,45,45,45,45,45,45,45,45,-18,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,42,45,45,45,45,45,45,45,46,41,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,45,45,-25,45,45,45,-28,32,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,-28,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,36,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,45,45,35,45,45,45,45,45,45,45,45,45,45,45,45,45,46,45,45,19,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-25,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,24,45,45,45,45,45,45,45,45,45,-31,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,-27,38,45,45,44,45,45,45,45,45,48,45,45,-27,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,41,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-33,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-31,45,45,-31,45,-27,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,-31,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-23,45,45,45,45,45,-27,45,45,45,45,43,45,45,45,45,45,45,45,45,45,45,45,40,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,43,45,45,45,43,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,48,45,45,45,45,45,-23,45,-24,45,45,45,45,45,45,-23,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-26,45,45,45,45,45,45,45,45,45,45,-22,45,45,45,45,45,45,45,45,45,45,45,-31,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,24,45,45,45,45,45,45,45,45,45,45,45,-32,45,45,45,45,42,45,45,-23,45,45,45,45,45,45,45,-27,45,45,45,45,45,45,45,-28,45,45]
plt.plot(k)
def moving_average(a, n=10) :
    ret = np.cumsum(a, dtype=float)
    ret[n:] = ret[n:] - ret[:-n]
    return ret[n - 1:] / n
plt.plot(moving_average(k))
plt.xlabel('Episodes')
plt.ylabel('rewards')
plt.title('Q Table Performance')
#plt.savefig('output\\qtable_rewards_3_3.png')
plt.show()