def controls(self, move):
    '''Returns a set of attacked/defended squares'''
    to_move = self.board.turn
    analysis_board = chess.Board(self.board.fen())
    analysis_board.push(move)
    squares = 0
    for square in chess.SQUARES:
      if move.to_square in analysis_board.attackers(to_move, square):
        squares |= chess.BB_SQUARES[square]
    return SquareSet(squares)
def controls ( self , move ) : to_move = self . board . turn analysis_board = chess . Board ( self . board . fen ( ) ) analysis_board . push ( move ) squares = 0 for square in chess . SQUARES : if move . to_square in analysis_board . attackers ( to_move , square ) : squares |= chess . BB_SQUARES [ square ] return SquareSet ( squares )
Returns a set of attacked/defended squares