2020-12-04 18:17:39 -08:00
|
|
|
require "./intcode.cr"
|
2020-11-30 22:16:06 -08:00
|
|
|
lines = File.read("day2.txt").lines.map(&.split(",").map(&.to_i32)).flatten
|
|
|
|
100.times do |noun|
|
|
|
|
100.times do |verb|
|
2020-12-04 18:17:39 -08:00
|
|
|
prog = lines.clone
|
|
|
|
prog[1] = noun
|
|
|
|
prog[2] = verb
|
|
|
|
if run(prog, [] of Int32)[1][0] == 19690720
|
2020-11-30 22:16:06 -08:00
|
|
|
puts 100*noun + verb
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|