Example #1
0
    def play_no_printing(self):
        while not self.board.is_game_over():
            if self.is_white_turn():
                move = self.player1.calculate_move(self.board, True, self.depth)
                self.board.push(move)
            else:
                move = self.player2.calculate_move(self.board, False, self.depth)
                self.board.push(move)

        return game_tools.get_winner(self.board)
Example #2
0
    def play_no_printing(self):
        while not self.board.is_game_over():
            if self.is_white_turn():
                move = self.player1.calculate_move(self.board, True,
                                                   self.depth)
                self.board.push(move)
            else:
                move = self.player2.calculate_move(self.board, False,
                                                   self.depth)
                self.board.push(move)

        return game_tools.get_winner(self.board)
Example #3
0
    def play(self):
        while not self.board.is_game_over():
            if self.is_white_turn():
                print("player 1, white's turn, %s" % self.player1)
                move = self.player1.calculate_move(self.board, True, self.depth)
                self.board.push(move)
            else:
                print("player 2, black's turn, %s" % self.player2)
                move = self.player2.calculate_move(self.board, False, self.depth)
                self.board.push(move)

            print(self.board)
            print("")
            print("")

        return game_tools.get_winner(self.board)
Example #4
0
    def play(self):
        while not self.board.is_game_over():
            if self.is_white_turn():
                print("player 1, white's turn, %s" % self.player1)
                move = self.player1.calculate_move(self.board, True,
                                                   self.depth)
                self.board.push(move)
            else:
                print("player 2, black's turn, %s" % self.player2)
                move = self.player2.calculate_move(self.board, False,
                                                   self.depth)
                self.board.push(move)

            print(self.board)
            print("")
            print("")

        return game_tools.get_winner(self.board)
Example #5
0
    def play_with_avg_moves(self):
        total_time_p1 = 0
        total_time_p2 = 0
        num_moves_p1 = 0
        num_moves_p2 = 0
        while not self.board.is_game_over():
            if self.is_white_turn():
                move, move_time = self.player1.calculate_move_timed(self.board, True, self.depth)
                total_time_p1 += move_time
                num_moves_p1 += 1
                self.board.push(move)
            else:
                move, move_time = self.player2.calculate_move_timed(self.board, False, self.depth)
                total_time_p1 += move_time
                num_moves_p2 += 1
                self.board.push(move)

        avg_move_time_p1 = total_time_p1 / num_moves_p1
        avg_move_time_p2 = total_time_p2 / num_moves_p2
        return game_tools.get_winner(self.board), avg_move_time_p1, avg_move_time_p2
Example #6
0
    def play_with_avg_moves(self):
        total_time_p1 = 0
        total_time_p2 = 0
        num_moves_p1 = 0
        num_moves_p2 = 0
        while not self.board.is_game_over():
            if self.is_white_turn():
                move, move_time = self.player1.calculate_move_timed(
                    self.board, True, self.depth)
                total_time_p1 += move_time
                num_moves_p1 += 1
                self.board.push(move)
            else:
                move, move_time = self.player2.calculate_move_timed(
                    self.board, False, self.depth)
                total_time_p1 += move_time
                num_moves_p2 += 1
                self.board.push(move)

        avg_move_time_p1 = total_time_p1 / num_moves_p1
        avg_move_time_p2 = total_time_p2 / num_moves_p2
        return game_tools.get_winner(
            self.board), avg_move_time_p1, avg_move_time_p2