def validate_positions *positions, size
      positions.each do |pos|
        raise IndexError, "#{pos} is not a valid position." if pos >= size
      end
    end
def validate_positions *positions, size
      positions.each do |pos|
        raise IndexError, "#{pos} is not a valid position." if pos >= size
      end
    end
Raises IndexError when one of the positions is not a valid position