aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common.rs4
-rw-r--r--src/lib.rs16
-rw-r--r--src/main.rs28
-rw-r--r--src/y2018.rs7
-rw-r--r--src/y2018/day1.rs (renamed from src/day1.rs)0
-rw-r--r--src/y2018/day2.rs (renamed from src/day2.rs)0
-rw-r--r--src/y2018/day3.rs (renamed from src/day3.rs)0
-rw-r--r--src/y2018/day4.rs (renamed from src/day4.rs)0
-rw-r--r--src/y2018/day5.rs (renamed from src/day5.rs)0
-rw-r--r--src/y2018/day6.rs (renamed from src/day6.rs)0
-rw-r--r--src/y2018/day7.rs (renamed from src/day7.rs)0
11 files changed, 24 insertions, 31 deletions
diff --git a/src/common.rs b/src/common.rs
index f053195..b3cb656 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -2,14 +2,14 @@
use std::io;
-/// Reads from stdin until an empty line is detected
+/// Reads from stdin until an empty line is encountered
///
/// Returns the read data as a string
pub fn read_stdin_to_string() -> String {
let mut input = String::new();
let mut line = String::new();
- println!("enter puzzle input followed by an empty line:");
+ println!("Enter puzzle input followed by an empty line:");
loop {
io::stdin().read_line(&mut line).unwrap();
if line.trim() == "" {
diff --git a/src/lib.rs b/src/lib.rs
index bbf2b25..b10f553 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,16 +1,2 @@
mod common;
-pub mod day1;
-pub mod day2;
-pub mod day3;
-pub mod day4;
-pub mod day5;
-pub mod day6;
-pub mod day7;
-
-#[cfg(test)]
-mod tests {
- #[test]
- fn it_works() {
- assert_eq!(2 + 2, 4);
- }
-}
+pub mod y2018;
diff --git a/src/main.rs b/src/main.rs
index bfbae08..d2f028b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,20 +8,20 @@ fn main() {
}
let mut puzzle_solution_map: BTreeMap<&str, fn()> = BTreeMap::new();
- puzzle_solution_map.insert("day1::part1", advent_of_code_2018::day1::part1);
- puzzle_solution_map.insert("day1::part2", advent_of_code_2018::day1::part2);
- puzzle_solution_map.insert("day2::part1", advent_of_code_2018::day2::part1);
- puzzle_solution_map.insert("day2::part2", advent_of_code_2018::day2::part2);
- puzzle_solution_map.insert("day3::part1", advent_of_code_2018::day3::part1);
- puzzle_solution_map.insert("day3::part2", advent_of_code_2018::day3::part2);
- puzzle_solution_map.insert("day4::part1", advent_of_code_2018::day4::part1);
- puzzle_solution_map.insert("day4::part2", advent_of_code_2018::day4::part2);
- puzzle_solution_map.insert("day5::part1", advent_of_code_2018::day5::part1);
- puzzle_solution_map.insert("day5::part2", advent_of_code_2018::day5::part2);
- puzzle_solution_map.insert("day6::part1", advent_of_code_2018::day6::part1);
- puzzle_solution_map.insert("day6::part2", advent_of_code_2018::day6::part2);
- puzzle_solution_map.insert("day7::part1", advent_of_code_2018::day7::part1);
- puzzle_solution_map.insert("day7::part2", advent_of_code_2018::day7::part2);
+ puzzle_solution_map.insert("y2018::day1::part1", advent_of_code::y2018::day1::part1);
+ puzzle_solution_map.insert("y2018::day1::part2", advent_of_code::y2018::day1::part2);
+ puzzle_solution_map.insert("y2018::day2::part1", advent_of_code::y2018::day2::part1);
+ puzzle_solution_map.insert("y2018::day2::part2", advent_of_code::y2018::day2::part2);
+ puzzle_solution_map.insert("y2018::day3::part1", advent_of_code::y2018::day3::part1);
+ puzzle_solution_map.insert("y2018::day3::part2", advent_of_code::y2018::day3::part2);
+ puzzle_solution_map.insert("y2018::day4::part1", advent_of_code::y2018::day4::part1);
+ puzzle_solution_map.insert("y2018::day4::part2", advent_of_code::y2018::day4::part2);
+ puzzle_solution_map.insert("y2018::day5::part1", advent_of_code::y2018::day5::part1);
+ puzzle_solution_map.insert("y2018::day5::part2", advent_of_code::y2018::day5::part2);
+ puzzle_solution_map.insert("y2018::day6::part1", advent_of_code::y2018::day6::part1);
+ puzzle_solution_map.insert("y2018::day6::part2", advent_of_code::y2018::day6::part2);
+ puzzle_solution_map.insert("y2018::day7::part1", advent_of_code::y2018::day7::part1);
+ puzzle_solution_map.insert("y2018::day7::part2", advent_of_code::y2018::day7::part2);
let command = args[1].as_str();
if command == "list" {
diff --git a/src/y2018.rs b/src/y2018.rs
new file mode 100644
index 0000000..da2f914
--- /dev/null
+++ b/src/y2018.rs
@@ -0,0 +1,7 @@
+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/day1.rs b/src/y2018/day1.rs
index 91ea0bf..91ea0bf 100644
--- a/src/day1.rs
+++ b/src/y2018/day1.rs
diff --git a/src/day2.rs b/src/y2018/day2.rs
index 6f92604..6f92604 100644
--- a/src/day2.rs
+++ b/src/y2018/day2.rs
diff --git a/src/day3.rs b/src/y2018/day3.rs
index 434de69..434de69 100644
--- a/src/day3.rs
+++ b/src/y2018/day3.rs
diff --git a/src/day4.rs b/src/y2018/day4.rs
index 7c1bf2e..7c1bf2e 100644
--- a/src/day4.rs
+++ b/src/y2018/day4.rs
diff --git a/src/day5.rs b/src/y2018/day5.rs
index 2b836d8..2b836d8 100644
--- a/src/day5.rs
+++ b/src/y2018/day5.rs
diff --git a/src/day6.rs b/src/y2018/day6.rs
index a8a1202..a8a1202 100644
--- a/src/day6.rs
+++ b/src/y2018/day6.rs
diff --git a/src/day7.rs b/src/y2018/day7.rs
index 1dffd94..1dffd94 100644
--- a/src/day7.rs
+++ b/src/y2018/day7.rs