aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar alecdwm 2019-12-02 01:46:28 +1000
committerGravatar alecdwm 2019-12-02 01:46:28 +1000
commitfb36c4a9bbf7f477c98cf2a5fa0959d9967c9168 (patch)
treec7d0df7e8fd3bb041e7b39d1783c2c8728ac00db
parent834c84a1bddcbefbb383226f13e1d38043a773be (diff)
moved year 2018 puzzles to y2018 module
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml2
-rw-r--r--README.md3
-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
14 files changed, 30 insertions, 34 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 616734c..4389501 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,4 +1,6 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
[[package]]
-name = "advent-of-code-2018"
+name = "advent-of-code"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index 102099b..3459379 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "advent-of-code-2018"
+name = "advent-of-code"
version = "0.1.0"
authors = ["alecdwm <alec@owls.io>"]
edition = "2018"
diff --git a/README.md b/README.md
index 7f35e49..c6c185e 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
-# Advent of Code 2018
+# Advent of Code
+## 2018
https://adventofcode.com/2018
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