engine.py
def castling_queenside_possible(self):
        """Return True if the player in turn can make queenside castling
        and False if not. This function is assumed to only be used if no moves
        have been made to the game_state object, since castling rights may not
        valid then."""
        if self.check():
            return False
        if self.white_to_play:
            if "Q" in self.castling_possibilities:
                if self.board[1] == self.board[2] == self.board[3] == None:

                    king = self.board[4]
                    move = Move()
                    move.add_change(4, king, None)
                    move.add_change(3, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)

                    move = Move()
                    move.add_change(4, king, None)
                    move.add_change(2, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)

                    return True
        else:
            if "q" in self.castling_possibilities:

                if self.board[57] == self.board[58] == self.board[59] == None:

                    king = self.board[60]
                    move = Move()
                    move.add_change(60, king, None)
                    move.add_change(59, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)

                    move = Move()
                    move.add_change(60, king, None)
                    move.add_change(58, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)

                    return True
        return False
Return True if the player in turn can make queenside castling
        and False if not. This function is assumed to only be used if no moves
        have been made to the game_state object, since castling rights may not
        valid then.
Return True if the player in turn can make queenside castling
and False if not. This function is assumed to only be used if no moves
have been made to the game_state object, since castling rights may not
valid then.
Return True if the player in turn can make queenside castling and False if not . This function is assumed to only be used if no moves have been made to the game_state object since castling rights may not valid then .
def castling_queenside_possible(self):
        if self.check():
            return False
        if self.white_to_play:
            if "Q" in self.castling_possibilities:
                if self.board[1] == self.board[2] == self.board[3] == None:
                    king = self.board[4]
                    move = Move()
                    move.add_change(4, king, None)
                    move.add_change(3, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)
                    move = Move()
                    move.add_change(4, king, None)
                    move.add_change(2, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)
                    return True
        else:
            if "q" in self.castling_possibilities:
                if self.board[57] == self.board[58] == self.board[59] == None:
                    king = self.board[60]
                    move = Move()
                    move.add_change(60, king, None)
                    move.add_change(59, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)
                    move = Move()
                    move.add_change(60, king, None)
                    move.add_change(58, None, king)
                    self.make_move(move)
                    if abs(minimax(self, 1)) > 500:
                        self.undo_move(move)
                        return False
                    self.undo_move(move)
                    return True
        return False
def castling_queenside_possible ( self ) : if self . check ( ) : return False if self . white_to_play : if "Q" in self . castling_possibilities : if self . board [ 1 ] == self . board [ 2 ] == self . board [ 3 ] == None : king = self . board [ 4 ] move = Move ( ) move . add_change ( 4 , king , None ) move . add_change ( 3 , None , king ) self . make_move ( move ) if abs ( minimax ( self , 1 ) ) > 500 : self . undo_move ( move ) return False self . undo_move ( move ) move = Move ( ) move . add_change ( 4 , king , None ) move . add_change ( 2 , None , king ) self . make_move ( move ) if abs ( minimax ( self , 1 ) ) > 500 : self . undo_move ( move ) return False self . undo_move ( move ) return True else : if "q" in self . castling_possibilities : if self . board [ 57 ] == self . board [ 58 ] == self . board [ 59 ] == None : king = self . board [ 60 ] move = Move ( ) move . add_change ( 60 , king , None ) move . add_change ( 59 , None , king ) self . make_move ( move ) if abs ( minimax ( self , 1 ) ) > 500 : self . undo_move ( move ) return False self . undo_move ( move ) move = Move ( ) move . add_change ( 60 , king , None ) move . add_change ( 58 , None , king ) self . make_move ( move ) if abs ( minimax ( self , 1 ) ) > 500 : self . undo_move ( move ) return False self . undo_move ( move ) return True return False
Return True if the player in turn can make queenside castling
and False if not.
Return True if the player in turn can make queenside castling and False if not .
"""Return True if the player in turn can make queenside castling
        and False if not. This function is assumed to only be used if no moves
        have been made to the game_state object, since castling rights may not
        valid then."""
self