import matplotlib.pyplot as plt

from utilities.constants import GREEN, WHITE

# winners = []
with open("winners.txt") as f:
    winners = f.readlines()

winners = [int(x.strip()) for x in winners]


fig, ax = plt.subplots()
bar = ax.bar(["Draw", "White", "Green"], [winners.count(0), winners.count(WHITE), winners.count(GREEN)])
ax.set(xlabel='Winner', ylabel='Frequency', ylim=[0, 500])
ax.set_title("Winners")
ax.bar_label(bar)
plt.show()


with open("rewardsA.txt") as f:
    totalReward = f.readlines()


plt.plot([i for i in range(len(totalReward))], totalReward)
plt.xlabel("Games")
plt.ylabel("Reward")
plt.show()