Skip to content

Solve 2015-19 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ All currently implemented puzzles run in 200ms or less.
| 16 | [Aunt Sue](puzzles/2015/2015-16/) | ✅ | ✅ |
| 17 | No Such Thing as Too Much | ❌ | ❌ |
| 18 | Like a GIF For Your Yard | ❌ | ❌ |
| 19 | Medicine for Rudolph | ❌ | ❌ |
| 19 | [Medicine for Rudolph](puzzles/2015/2015-19/) | ❌ | ❌ |
| 20 | Infinite Elves and Infinite Houses | ❌ | ❌ |
| 21 | RPG Simulator 20XX | ❌ | ❌ |
| 22 | Wizard Simulator 20XX | ❌ | ❌ |
Expand Down
6 changes: 6 additions & 0 deletions puzzles/2015/2015-19/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "puzzle-2015-19"
edition = "2024"

[dependencies]
ornament.workspace = true
45 changes: 45 additions & 0 deletions puzzles/2015/2015-19/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Al => ThF
Al => ThRnFAr
B => BCa
B => TiB
B => TiRnFAr
Ca => CaCa
Ca => PB
Ca => PRnFAr
Ca => SiRnFYFAr
Ca => SiRnMgAr
Ca => SiTh
F => CaF
F => PMg
F => SiAl
H => CRnAlAr
H => CRnFYFYFAr
H => CRnFYMgAr
H => CRnMgYFAr
H => HCa
H => NRnFYFAr
H => NRnMgAr
H => NTh
H => OB
H => ORnFAr
Mg => BF
Mg => TiMg
N => CRnFAr
N => HSi
O => CRnFYFAr
O => CRnMgAr
O => HP
O => NRnFAr
O => OTi
P => CaP
P => PTi
P => SiRnFAr
Si => CaSi
Th => ThCa
Ti => BP
Ti => TiTi
e => HF
e => NAl
e => OMg

ORnPBPMgArCaCaCaSiThCaCaSiThCaCaPBSiRnFArRnFArCaCaSiThCaCaSiThCaCaCaCaCaCaSiRnFYFArSiRnMgArCaSiRnPTiTiBFYPBFArSiRnCaSiRnTiRnFArSiAlArPTiBPTiRnCaSiAlArCaPTiTiBPMgYFArPTiRnFArSiRnCaCaFArRnCaFArCaSiRnSiRnMgArFYCaSiRnMgArCaCaSiThPRnFArPBCaSiRnMgArCaCaSiThCaSiRnTiMgArFArSiThSiThCaCaSiRnMgArCaCaSiRnFArTiBPTiRnCaSiAlArCaPTiRnFArPBPBCaCaSiThCaPBSiThPRnFArSiThCaSiThCaSiThCaPTiBSiRnFYFArCaCaPRnFArPBCaCaPBSiRnTiRnFArCaPRnFArSiRnCaCaCaSiThCaRnCaFArYCaSiRnFArBCaCaCaSiThFArPBFArCaSiRnFArRnCaCaCaFArSiRnFArTiRnPMgArF
26 changes: 26 additions & 0 deletions puzzles/2015/2015-19/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
mod part1;

pub use part1::part_1;

#[cfg(test)]
mod tests {
const INPUT: &str = include_str!("../input.txt");

#[test]
fn part_1() {
use super::part_1;

assert_eq!(
part_1(
"
H => HO
H => OH
O => HH
"
),
4
);

assert_eq!(part_1(INPUT), 576);
}
}
17 changes: 17 additions & 0 deletions puzzles/2015/2015-19/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use ornament::{Puzzle, Solution};
use puzzle_2015_19::part_1;

fn main() {
Puzzle {
name: "Medicine for Rudolph",
year: 2015,
day: 19,
part_1: |input| {
Solution::new(part_1, input, |answer| {
format!("{answer} molecules can be created")
})
},
part_2: None,
}
.solve(include_str!("../input.txt"))
}
3 changes: 3 additions & 0 deletions puzzles/2015/2015-19/src/part1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn part_1(input: &str) -> usize {
todo!()
}
Loading