(rocks, max_i + 2)
}
-pub fn poor_sand(mut rocks: Rocks, floor: usize) -> (i32, i32) {
+pub fn pour_sand(mut rocks: Rocks, floor: usize) -> (i32, i32) {
let mut n = 0;
let mut first_n_touching_floor = 0;
#[test]
fn part1() {
let (rocks, floor) = parse(ROCKS);
- assert_eq!(poor_sand(rocks, floor).0, 24);
+ assert_eq!(pour_sand(rocks, floor).0, 24);
}
#[test]
fn part2() {
let (rocks, floor) = parse(ROCKS);
- assert_eq!(poor_sand(rocks, floor).1, 93);
+ assert_eq!(pour_sand(rocks, floor).1, 93);
}
}
pub fn day14() -> String {
let (rocks, floor) = day14::parse(&fs::read_to_string("data/day14.input").unwrap());
- let (first_grain_touching_floor, last_grain) = day14::poor_sand(rocks, floor);
+ let (first_grain_touching_floor, last_grain) = day14::pour_sand(rocks, floor);
format!(
"part1: {}, part2: {}",
first_grain_touching_floor, last_grain