# ============================================================================= # # game1 = pl(env,agent1,agent2,display_it) # winner = game1.play_game(q_class) # # ============================================================================= agent1_wins = 0 agent2_wins = 0 draws = 0 while (game_count < total_games): env = dbs(grid_size=(2, 2)) agent1 = q_agent() agent2 = random_agent() game1 = pl(env, agent1, agent2, display_it) winner = game1.play_game(q_class) game_count += 1 if winner == 1: agent1_wins += 1 elif winner == 2: agent2_wins += 1 elif winner == 0: draws += 1 print('agent 1 wins = ', agent1_wins, 'agent 2 wins = ', agent2_wins, 'draws = ', draws) # ============================================================================= # pickle_out = open("dict.pickle","wb")
# -*- coding: utf-8 -*- """ Created on Mon Apr 29 16:06:40 2019 @author: Srujan Panuganti """ import numpy as np from operator import add from dots_and_boxes import dots_and_boxes as dbs from q_algorithm import q_learn from agent import q_agent from play import play as pl env = dbs(grid_size = (2,2)) agent1 = q_agent() agent2 = q_agent() q_class = q_learn(total_actions = 12) game1 = pl(env,agent1,agent2) winner, q_class = game1.play_game(q_class)