code: def compute_territory(self):
          
          # Initialize the square occupancy vector of the board.
          vector = self.board.new_vector()
  
          # Mark current position as reachable.
          vector[self.index] = True
  
          # List all places reacheable by the piece from its current position.
          for x_shift, y_shift in self.movements:
              # Mark side positions as reachable if in the limit of the board.
              try:
                  reachable_index = self.board.coordinates_to_index(
                      self.x, self.y, x_shift, y_shift)
              except ForbiddenCoordinates:
                  continue
              vector[reachable_index] = True
  
          return vector
docs: Compute territory reachable by the piece from its current position.
  
          Returns a list of boolean flags of squares indexed linearly, for which
          a True means the square is reachable.