1
Fork 0
advent-of-code-2021/run.rb
2021-12-09 11:22:17 +01:00

19 lines
498 B
Ruby
Executable file

#!/usr/bin/env ruby
puzzle = (ARGV[0] ? ARGV[0] : '1').rjust(2, '0')
part = ARGV[1] ? ARGV[1] : '1'
require './puzzles/%s_%s/main.rb' % [puzzle, part]
if part == '1'
f = File.open('./puzzles/%s_%s/input.txt' % [puzzle, part], 'r')
elsif File.exists?('./puzzles/%s_%s/input.txt' % [puzzle, part])
f = File.open('./puzzles/%s_%s/input.txt' % [puzzle, part], 'r')
else
f = File.open('./puzzles/%s_1/input.txt' % [puzzle, part], 'r')
end
res = run f
puts "Result: " + res.to_s
f.close