Skip to content

Commit 5a953af

Browse files
committed
chore: WIP for y2025::day_09::part_2
1 parent 24b32c7 commit 5a953af

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

aoclp_solutions/src/y2025/day_09.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
use std::collections::{HashMap, HashSet};
2+
use std::hash::Hash;
3+
use std::iter::successors;
4+
15
use aoclp::positioning::pt::{rectangular_area, Pt};
26
use aoclp::solvers_impl::input::safe_get_input_as_many;
37
use itertools::Itertools;
8+
use strum::EnumIs;
49

510
pub fn part_1() -> i64 {
611
input()
@@ -15,6 +20,35 @@ pub fn part_2() -> usize {
1520
0
1621
}
1722

23+
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash, EnumIs)]
24+
enum Tile {
25+
#[default]
26+
Pink,
27+
Red,
28+
Green,
29+
}
30+
31+
#[derive(Debug, Clone)]
32+
struct Floor(HashMap<Pt, Tile>);
33+
34+
impl Default for Floor {
35+
fn default() -> Self {
36+
let tiles = input();
37+
38+
let _path: HashSet<_> = tiles
39+
.iter()
40+
.tuple_windows()
41+
.flat_map(|(a, b)| {
42+
let displacement = Pt::new((b.x - a.x).signum(), (b.y - a.y).signum());
43+
let b = *b;
44+
successors(Some(*a), move |&p| (p != b).then_some(p + displacement))
45+
})
46+
.collect();
47+
48+
todo!()
49+
}
50+
}
51+
1852
fn input() -> Vec<Pt> {
1953
safe_get_input_as_many(2025, 9)
2054
}

0 commit comments

Comments
 (0)