diff --git a/2017/input/day_17.txt b/2017/input/day_17.txt new file mode 100644 index 0000000..41a4a81 --- /dev/null +++ b/2017/input/day_17.txt @@ -0,0 +1 @@ +328 \ No newline at end of file diff --git a/2017/ruby/day_17.rb b/2017/ruby/day_17.rb new file mode 100644 index 0000000..c3f4ff2 --- /dev/null +++ b/2017/ruby/day_17.rb @@ -0,0 +1,21 @@ +input = ARGF.read.strip.to_i +# input = 3 + +# buffer = [0] +pos = 0 +50_000_000.times do |i| +# 10.times do |i| + pos += input + 1 + # pos %= buffer.size + pos %= i + 1 + + p i+1 if pos.zero? + + # buffer = (buffer[0..pos] << i+1).concat(buffer[pos+1..-1]) +end + +# index = buffer.index(0) +# p buffer[index+1] + +# So 0 is always element 0... +# So we just need to know when something is inserted at element 1?