Day 14, puzzle 2

This commit is contained in:
jazzpi
2022-12-16 09:52:48 +01:00
parent 215e067d33
commit d05780e64a
3 changed files with 39 additions and 8 deletions

View File

@ -1,7 +1,7 @@
use aoc22::{day14, util};
pub fn main() {
let mut cave = day14::parse_cave(&util::parse_input());
let mut cave = day14::parse_cave(&util::parse_input(), false);
println!("Initial cave:");
cave.print();

17
src/bin/d14p2.rs Normal file
View File

@ -0,0 +1,17 @@
use aoc22::{day14, util};
pub fn main() {
let mut cave = day14::parse_cave(&util::parse_input(), true);
println!("Initial cave:");
cave.print();
let mut sand = 0;
while cave.drop_sand() {
sand += 1;
}
println!("Final cave:");
cave.print();
println!("Total sand dropped: {}", sand);
}