added code to solve part 2
parent
2330820811
commit
7574cfa2ae
|
@ -3,7 +3,9 @@ require 'pry'
|
||||||
numbers = File.read('./input').split(',')
|
numbers = File.read('./input').split(',')
|
||||||
numbers.map!(&:to_i)
|
numbers.map!(&:to_i)
|
||||||
|
|
||||||
2020.times do |i|
|
runs = 30000000
|
||||||
|
|
||||||
|
runs.times do |i|
|
||||||
next if i < numbers.size
|
next if i < numbers.size
|
||||||
num = numbers[-1]
|
num = numbers[-1]
|
||||||
prev_turn = numbers[..-2].reverse.find_index(num)
|
prev_turn = numbers[..-2].reverse.find_index(num)
|
||||||
|
|
Loading…
Reference in New Issue