def check_game_over(self, player_turn):
    "\n        Check if the game board is in a terminal state from the specified player's point of view.\n        (e.g. a certain player has won or lost, or there is a draw).\n        "
    white_moves = self.get_available_moves(Player.WHITE)
    black_moves = self.get_available_moves(Player.BLACK)
    if ((player_turn == Player.WHITE) and (not white_moves)):
        return GameOverReason.BLACK_WON
    if ((player_turn == Player.BLACK) and (not black_moves)):
        return GameOverReason.WHITE_WON
    white_squares = self.get_player_squares(Player.WHITE)
    black_squares = self.get_player_squares(Player.BLACK)
    only_one_king_each = ((len(white_squares) == 1) and (len(black_squares) == 1) and (self.piece_class[white_squares[0]] == PieceClass.KING) and (self.piece_class[black_squares[0]] == PieceClass.KING) and (not self.get_capturable_pieces(white_squares[0])) and (not self.get_capturable_pieces(black_squares[0])))
    if only_one_king_each:
        return GameOverReason.DRAW
    return None
Check if the game board is in a terminal state from the specified player's point of view.
(e.g. a certain player has won or lost, or there is a draw).
def check_game_over(self, player_turn):
    "\n        Check if the game board is in a terminal state from the specified player's point of view.\n        (e.g. a certain player has won or lost, or there is a draw).\n        "
    white_moves = self.get_available_moves(Player.WHITE)
    black_moves = self.get_available_moves(Player.BLACK)
    if ((player_turn == Player.WHITE) and (not white_moves)):
        return GameOverReason.BLACK_WON
    if ((player_turn == Player.BLACK) and (not black_moves)):
        return GameOverReason.WHITE_WON
    white_squares = self.get_player_squares(Player.WHITE)
    black_squares = self.get_player_squares(Player.BLACK)
    only_one_king_each = ((len(white_squares) == 1) and (len(black_squares) == 1) and (self.piece_class[white_squares[0]] == PieceClass.KING) and (self.piece_class[black_squares[0]] == PieceClass.KING) and (not self.get_capturable_pieces(white_squares[0])) and (not self.get_capturable_pieces(black_squares[0])))
    if only_one_king_each:
        return GameOverReason.DRAW
    return None