This repository serves as a template for the Advent of Code challenge, using Ruby as the language for solving the daily problems. This application includes:
- A CLI interface for executing the challenge code directly
- An RSpec collection for refactoring
For each challenge day, there is an entry file located at dayX/main.rb
, with three methods:
- An
initialize
, which takes in the puzzle input as an argument part1
, which returns the result for Part 1part2
, which returns the result for Part 2
When you receive your problem input, you can paste it into dayX/input.txt
, and it will be automatically read in with the CLI input and RSpec tests.
In the root folder is a main.rb
, which can be executed via CLI, and serves as an entry for all of the daily challenge classes.
There is also a spec/
folder with RSpec tests for each day. There is a dayX_spec.rb
for each day, which contains a test block for each part.
- Run
gem install bundler
if you do not have Bundler installed - Run
bundle install
to setup Rubocop and RSpec
- Run
ruby main.rb
from your CLI - When prompted, enter the day for which you want to output your solution.
- After solving a problem, paste your solution into the appropriate test block as
:expected
- Run the test via CLI using
rspec spec/dayX_spec.rb
, or from within RubyMine
You can run rubocop
to analyze your code quality. You can also autofix some minor infractions with rubocop -a
.
Advent of Code - Ruby is released under the MIT License.