def validate_positions *positions
      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 an invalid position