From: Ummon Date: Sun, 15 Dec 2019 20:27:58 +0000 (+0100) Subject: Beginning of day 14 X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=d14f6ebe72e3ddab9876254cc2780a4c4b700df8;p=advent_of_code_2019.git Beginning of day 14 --- diff --git a/src/day14.rs b/src/day14.rs new file mode 100644 index 0000000..40a3182 --- /dev/null +++ b/src/day14.rs @@ -0,0 +1,29 @@ +use std::collections::HashMap; + +fn parse_quantity_and_name(input: &str) -> (i32, String) { + let quantity_and_name: Vec<&str> = input.split(" ").collect(); + ( + quantity_and_name[0].parse::().unwrap(), + String::from(quantity_and_name[1].trim()) + ) +} + +fn parse(input: &str) -> HashMap)> { + let result = HashMap::)>::new(); + for line in input.lines() { + let reaction: Vec<&str> = line.split("=>").collect(); + let input_chemicals: Vec<(i32, String)> = + reaction[0].split(",").map(parse_quantity_and_name).collect(); + } + result +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn part1() { + + } +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 1d13545..32decbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ mod day10; mod day11; mod day12; mod day13; +mod day14; fn day01() -> String { let masses = common::read_list_of_numbers("data/day01.input", "\n");