class AocRb::App
Public Instance Methods
bootstrap(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 52 def bootstrap(year = options[:year], day = options[:day]) AocRb::Puzzle.create_templates(year, day) end
exec(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 73 def exec(year = options[:year], day = options[:day]) puzzle = AocRb::PuzzleSource.create_puzzle(year, day) input = AocRb::PuzzleInput.load(year, day) level = Puzzle.instructions_exist?(year, day, :part_2) ? 2 : 1 puts "#{year} Day #{day}" solution = PuzzleSource.run_part("part #{level}") { puzzle.send("part_#{level}", input) } puts "Submit solution? #{solution} (y/N)" submit = STDIN.gets.chomp.downcase puts "We said #{submit}" if submit == "y" if PuzzleSolution.submit(level, year, day, solution) puts "Correct!" if level == 1 puts "Downloading part 2!" fetch_instructions(year, day) end end end end
fetch(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 27 def fetch(year = options[:year], day = options[:day]) fetch_input(year, day) fetch_instructions(year, day) end
fetch_input(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 36 def fetch_input(year = options[:year], day = options[:day]) AocRb::PuzzleInput.download(year, day) end
fetch_instructions(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 44 def fetch_instructions(year = options[:year], day = options[:day]) AocRb::Puzzle.fetch_instructions(year, day) end
output(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 101 def output(year = options[:year], day = options[:day]) puzzle = AocRb::PuzzleSource.create_puzzle(year, day) input = AocRb::PuzzleInput.load(year, day) AocRb::PuzzleSource.run_part('part 1') { puzzle.part_1(input) } puts AocRb::PuzzleSource.run_part('part 2') { puzzle.part_2(input) } end
prep(year = options[:year], day = options[:day])
click to toggle source
# File lib/aoc_rb/app.rb, line 114 def prep(year = options[:year], day = options[:day]) fetch(year, day) bootstrap(year, day) end