def main(): """ Script to begin a match of Mancala. """ print("Welcome to Mancala!") # (optional) dynamic player types match = Match(player1_type=MLAI, player2_type=HumanPlayer, param_print_game_status=True) match.handle_next_move()
def run(self, routine): self.__reset() self.routine = routine self.match = Match(player1_type=RandomAI, player2_type=GeneticAlgorithmAI, param_print_game_status=False, param_matchgroup=2, training=self) self.num_turns = self.match.num_turns self.match.handle_next_move() self.won = self.match.winner == self.number self.finished_first = self.match.finished_first self.winner_num_pieces = self.match.winner_num_pieces
def main(): """ Script to run a matchs of Mancala. """ num_matches = 1000 matchlist = [ [ RandomAI, RandomAI ], #[ VectorAI, RandomAI ], #[ VectorAI, VectorAI ], #[ LeftmostAI, RandomAI ], #[ LeftmostAI, VectorAI ], #[ LeftmostAI, LeftmostAI ], #[ RightmostAI, RandomAI ], #[ RightmostAI, VectorAI ], #[ RightmostAI, LeftmostAI ], #[ RightmostAI, RightmostAI ] ] x=0 while x < len(matchlist): print ("Running " + str(num_matches) + " matches: " + matchlist[x][0].__name__ + " vs " + matchlist[x][1].__name__) counter = 0 while counter < num_matches: counter = counter + 1 match = Match(player1_type=matchlist[x][0], player2_type=matchlist[x][1], param_print_game_status=False, param_matchgroup=x) match.handle_next_move() if matchlist[x][0] != matchlist[x][1]: print ("Running " + str(num_matches) + " matches: " + matchlist[x][1].__name__ + " vs " + matchlist[x][0].__name__) counter = 0 while counter < num_matches: counter = counter + 1 match = Match(player1_type=matchlist[x][1], player2_type=matchlist[x][0], param_print_game_status=False, param_matchgroup=x) match.handle_next_move() x = x+1 print ("Matches Finished")
def main(): """ Script to begin a match of Mancala. """ #print("Welcome to Mancala!") #running vs vector multiple times #match = Match(player1_type=VectorAI, player2_type=VectorAI) #match.handle_next_move() #match = Match(player1_type=VectorAI, player2_type=VectorAI) #match.handle_next_move() #match = Match(player1_type=VectorAI, player2_type=VectorAI) #match.handle_next_move() opponents = [RandomAI, RightmostAI, LeftmostAI] for o in opponents: match = Match(player1_type=VectorAI, player2_type=o) match.handle_next_move()
def main(): """ Script to begin a match of Mancala. """ #print("Welcome to Mancala!") match = Match(player1_type=VectorAI, player2_type=RightmostAI) match.handle_next_move()