z = movingaverage(success,10) #chop off the remaining 10 z = z[:-10] z = numpy.concatenate((numpy.zeros(10), z)) plt.plot(z) plt.savefig(name) if opt.test: miner.load_params('eval.pth') game = Minesweeper() #to be changed upon GUI game.action(0) s = game.get_state() game.show() while game.get_status() == 0: a = miner.choose_action(s) game.action(a) game.show() else: win_num = 0 fail_num = 0 avg_rewards = [] success = [] for epoch in range(opt.n_epochs): game = Minesweeper() game.action(0) s = game.get_state() if game.get_status() == 1: continue #gets out of the loop if all have been uncovered critic_r = 0 ep_r = 0