aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar alecdwm 2019-12-02 18:05:11 +1000
committerGravatar alecdwm 2019-12-02 18:05:11 +1000
commit519d646e59e0efd2eb9681fbba751bfc969ef1fd (patch)
tree874fce436145d49ba8ff4761e1d2b8660f435c5b
parent5c981dfa26b7fad5f4e80337db5d221a8d200600 (diff)
renamed year modules and removed y prefix from cli commands
-rw-r--r--src/common.rs2
-rw-r--r--src/lib.rs28
-rw-r--r--src/main.rs34
-rw-r--r--src/y2018.rs15
-rw-r--r--src/y2019.rs6
-rw-r--r--src/year_2018/day1.rs (renamed from src/y2018/day1.rs)0
-rw-r--r--src/year_2018/day2.rs (renamed from src/y2018/day2.rs)0
-rw-r--r--src/year_2018/day3.rs (renamed from src/y2018/day3.rs)0
-rw-r--r--src/year_2018/day4.rs (renamed from src/y2018/day4.rs)0
-rw-r--r--src/year_2018/day5.rs (renamed from src/y2018/day5.rs)0
-rw-r--r--src/year_2018/day6.rs (renamed from src/y2018/day6.rs)0
-rw-r--r--src/year_2018/day7.rs (renamed from src/y2018/day7.rs)0
-rw-r--r--src/year_2019/day1.rs (renamed from src/y2019/day1.rs)0
-rw-r--r--src/year_2019/day2.rs (renamed from src/y2019/day2.rs)0
14 files changed, 43 insertions, 42 deletions
diff --git a/src/common.rs b/src/common.rs
index 9fda70a..656aa30 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1,5 +1,3 @@
-//! Common code used between the various puzzles
-
use std::io;
/// Collects from stdin into a String until an empty line is encountered
diff --git a/src/lib.rs b/src/lib.rs
index c141ade..8c25078 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,30 @@
//!
//! You don't need a computer science background to participate - just a little programming knowledge and some problem solving skills will get you pretty far. Nor do you need a fancy computer; every problem has a solution that completes in at most 15 seconds on ten-year-old hardware.
+/// Common code used between the various puzzles
mod common;
-pub mod y2018;
-pub mod y2019;
+
+/// "We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and Detection Instrument Station tells you. She sounded pretty worried when she called you down here. "At 500-year intervals into the past, someone has been changing Santa's history!"
+///
+/// "The good news is that the changes won't propagate to our time stream for another 25 days, and we have a device" - she attaches something to your wrist - "that will let you fix the changes with no such propagation delay. It's configured to send you 500 years further into the past every few days; that was the best we could do on such short notice."
+///
+/// "The bad news is that we are detecting roughly fifty anomalies throughout time; the device will indicate fixed anomalies with stars. The other bad news is that we only have one device and you're the best person for the job! Good lu--" She taps a button on the device and you suddenly feel like you're falling. To save Christmas, you need to get all fifty stars by December 25th.
+///
+/// Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
+pub mod year_2018 {
+ pub mod day1;
+ pub mod day2;
+ pub mod day3;
+ pub mod day4;
+ pub mod day5;
+ pub mod day6;
+ pub mod day7;
+}
+
+/// Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely align his warp drive, and return to Earth in time to save Christmas, he needs you to bring him measurements from fifty stars.
+///
+/// Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
+pub mod year_2019 {
+ pub mod day1;
+ pub mod day2;
+}
diff --git a/src/main.rs b/src/main.rs
index 70d7b4e..2f7adf1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,24 +4,24 @@ use std::env;
fn main() {
let mut puzzle_solutions: BTreeMap<&str, fn()> = BTreeMap::new();
- puzzle_solutions.insert("y2018::day1::part1", advent_of_code::y2018::day1::part1);
- puzzle_solutions.insert("y2018::day1::part2", advent_of_code::y2018::day1::part2);
- puzzle_solutions.insert("y2018::day2::part1", advent_of_code::y2018::day2::part1);
- puzzle_solutions.insert("y2018::day2::part2", advent_of_code::y2018::day2::part2);
- puzzle_solutions.insert("y2018::day3::part1", advent_of_code::y2018::day3::part1);
- puzzle_solutions.insert("y2018::day3::part2", advent_of_code::y2018::day3::part2);
- puzzle_solutions.insert("y2018::day4::part1", advent_of_code::y2018::day4::part1);
- puzzle_solutions.insert("y2018::day4::part2", advent_of_code::y2018::day4::part2);
- puzzle_solutions.insert("y2018::day5::part1", advent_of_code::y2018::day5::part1);
- puzzle_solutions.insert("y2018::day5::part2", advent_of_code::y2018::day5::part2);
- puzzle_solutions.insert("y2018::day6::part1", advent_of_code::y2018::day6::part1);
- puzzle_solutions.insert("y2018::day6::part2", advent_of_code::y2018::day6::part2);
- puzzle_solutions.insert("y2018::day7::part1", advent_of_code::y2018::day7::part1);
- puzzle_solutions.insert("y2018::day7::part2", advent_of_code::y2018::day7::part2);
+ puzzle_solutions.insert("2018::day1::part1", advent_of_code::year_2018::day1::part1);
+ puzzle_solutions.insert("2018::day1::part2", advent_of_code::year_2018::day1::part2);
+ puzzle_solutions.insert("2018::day2::part1", advent_of_code::year_2018::day2::part1);
+ puzzle_solutions.insert("2018::day2::part2", advent_of_code::year_2018::day2::part2);
+ puzzle_solutions.insert("2018::day3::part1", advent_of_code::year_2018::day3::part1);
+ puzzle_solutions.insert("2018::day3::part2", advent_of_code::year_2018::day3::part2);
+ puzzle_solutions.insert("2018::day4::part1", advent_of_code::year_2018::day4::part1);
+ puzzle_solutions.insert("2018::day4::part2", advent_of_code::year_2018::day4::part2);
+ puzzle_solutions.insert("2018::day5::part1", advent_of_code::year_2018::day5::part1);
+ puzzle_solutions.insert("2018::day5::part2", advent_of_code::year_2018::day5::part2);
+ puzzle_solutions.insert("2018::day6::part1", advent_of_code::year_2018::day6::part1);
+ puzzle_solutions.insert("2018::day6::part2", advent_of_code::year_2018::day6::part2);
+ puzzle_solutions.insert("2018::day7::part1", advent_of_code::year_2018::day7::part1);
+ puzzle_solutions.insert("2018::day7::part2", advent_of_code::year_2018::day7::part2);
- puzzle_solutions.insert("y2019::day1::part1", advent_of_code::y2019::day1::part1);
- puzzle_solutions.insert("y2019::day1::part2", advent_of_code::y2019::day1::part2);
- puzzle_solutions.insert("y2019::day2::part1", advent_of_code::y2019::day2::part1);
+ puzzle_solutions.insert("2019::day1::part1", advent_of_code::year_2019::day1::part1);
+ puzzle_solutions.insert("2019::day1::part2", advent_of_code::year_2019::day1::part2);
+ puzzle_solutions.insert("2019::day2::part1", advent_of_code::year_2019::day2::part1);
let command = match env::args().skip(1).next() {
Some(command) => command,
diff --git a/src/y2018.rs b/src/y2018.rs
deleted file mode 100644
index 4a87b0e..0000000
--- a/src/y2018.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//! "We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and Detection Instrument Station tells you. She sounded pretty worried when she called you down here. "At 500-year intervals into the past, someone has been changing Santa's history!"
-//!
-//! "The good news is that the changes won't propagate to our time stream for another 25 days, and we have a device" - she attaches something to your wrist - "that will let you fix the changes with no such propagation delay. It's configured to send you 500 years further into the past every few days; that was the best we could do on such short notice."
-//!
-//! "The bad news is that we are detecting roughly fifty anomalies throughout time; the device will indicate fixed anomalies with stars. The other bad news is that we only have one device and you're the best person for the job! Good lu--" She taps a button on the device and you suddenly feel like you're falling. To save Christmas, you need to get all fifty stars by December 25th.
-//!
-//! Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-
-pub mod day1;
-pub mod day2;
-pub mod day3;
-pub mod day4;
-pub mod day5;
-pub mod day6;
-pub mod day7;
diff --git a/src/y2019.rs b/src/y2019.rs
deleted file mode 100644
index 88a006d..0000000
--- a/src/y2019.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely align his warp drive, and return to Earth in time to save Christmas, he needs you to bring him measurements from fifty stars.
-//!
-//! Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-
-pub mod day1;
-pub mod day2;
diff --git a/src/y2018/day1.rs b/src/year_2018/day1.rs
index c99e2f9..c99e2f9 100644
--- a/src/y2018/day1.rs
+++ b/src/year_2018/day1.rs
diff --git a/src/y2018/day2.rs b/src/year_2018/day2.rs
index f90b293..f90b293 100644
--- a/src/y2018/day2.rs
+++ b/src/year_2018/day2.rs
diff --git a/src/y2018/day3.rs b/src/year_2018/day3.rs
index 871f6de..871f6de 100644
--- a/src/y2018/day3.rs
+++ b/src/year_2018/day3.rs
diff --git a/src/y2018/day4.rs b/src/year_2018/day4.rs
index e417ff8..e417ff8 100644
--- a/src/y2018/day4.rs
+++ b/src/year_2018/day4.rs
diff --git a/src/y2018/day5.rs b/src/year_2018/day5.rs
index 93ee47d..93ee47d 100644
--- a/src/y2018/day5.rs
+++ b/src/year_2018/day5.rs
diff --git a/src/y2018/day6.rs b/src/year_2018/day6.rs
index c577233..c577233 100644
--- a/src/y2018/day6.rs
+++ b/src/year_2018/day6.rs
diff --git a/src/y2018/day7.rs b/src/year_2018/day7.rs
index c926ca7..c926ca7 100644
--- a/src/y2018/day7.rs
+++ b/src/year_2018/day7.rs
diff --git a/src/y2019/day1.rs b/src/year_2019/day1.rs
index a47b116..a47b116 100644
--- a/src/y2019/day1.rs
+++ b/src/year_2019/day1.rs
diff --git a/src/y2019/day2.rs b/src/year_2019/day2.rs
index a45aab6..a45aab6 100644
--- a/src/y2019/day2.rs
+++ b/src/year_2019/day2.rs