# Human vs. AlphaBeta # ''' g = game.Game(7, # width 6, # height 4, # tokens in a row to win agent.InteractiveAgent("human"), # player 1 aba.AlphaBetaAgent("alphabeta", 4)) # player 2 ''' g = game.Game(7, # width 6, # height 4, # tokens in a row to win aba.AlphaBetaAgent("alphabeta", 4), agent.InteractiveAgent("human")) # # Human vs. Human # # g = game.Game(7, # width # 6, # height # 4, # tokens in a row to win # agent.InteractiveAgent("human1"), # player 1 # agent.InteractiveAgent("human2")) # player 2 # Jacked AI vs. Jacked AI '''
# Random vs. AlphaBeta #g = game.Game(7, # width # 6, # height # 4, # tokens in a row to win # aba.AlphaBetaAgent("Andrew's", 4,2), # aba.AlphaBetaAgent("Evan's",4,1)) # player 2) # player 2 # # Human vs. AlphaBeta # g = game.Game( 7, # width 6, # height 4, # tokens in a row to win agent.InteractiveAgent("human"), # player 1 aba.AlphaBetaAgent("alphabeta", 4, 1)) # player 2 # # Human vs. Human # # g = game.Game(7, # width # 6, # height # 4, # tokens in a row to win # agent.InteractiveAgent("human1"), # player 1 # agent.InteractiveAgent("human2")) # player 2 # Execute the game outcome = g.go()
import random import game import agent import alpha_beta_agent as aba # Set random seed for reproducibility # random.seed(1) games = [] games.append( game.Game(7, 6, 4, agent.InteractiveAgent("random"), aba.AlphaBetaAgent("alphabeta"))) # games.append(game.Game(7, 6, 5, aba.AlphaBetaAgent("alphabeta"), agent.RandomAgent("random"))) # games.append(game.Game(10, 8, 4, aba.AlphaBetaAgent("alphabeta"), agent.RandomAgent("random"))) # games.append(game.Game(10, 8, 5, aba.AlphaBetaAgent("alphabeta"), agent.RandomAgent("random"))) # for i in range(96): # width = random.randint(7, 10) # height = random.randint(6, 8) # token = random.randint(4, 5) # randomPlayer = random.randint(1, 2) # if randomPlayer == 1: # games.append(game.Game(width, height, token, agent.RandomAgent("random"), aba.AlphaBetaAgent("alphabeta"))) # else: # games.append(game.Game(width, height, token, aba.AlphaBetaAgent("alphabeta"), agent.RandomAgent("random"))) # Execute the game wins = 0 ties = 0 game_num = 0 max_times = [] for game in games: game_num += 1