Add day 15

This commit is contained in:
Sebastian Knackstedt 2022-12-16 09:57:27 +01:00
parent d34dcb5957
commit e0900ec2ed
Signed by: sebastian
GPG Key ID: CDCD9AF904D93EF7

View File

@ -63,7 +63,15 @@ fn main() {
let mut beacons = vec![]; let mut beacons = vec![];
for line in lines { for line in lines {
beacons.push(line.split([' ', '=', ':', ',']).filter_map(|tok| tok.parse::<i32>().ok()).collect::<Vec<_>>().chunks_exact(4).map(|positions| Beacon { pos: Pos(positions[0], positions[1]), beacon: Pos(positions[2], positions[3]) }).next().unwrap()); beacons.push(
line.split([' ', '=', ':', ','])
.filter_map(|tok| tok.parse::<i32>().ok())
.collect::<Vec<_>>()
.chunks_exact(4)
.map(|positions| Beacon { pos: Pos(positions[0], positions[1]), beacon: Pos(positions[2], positions[3]) })
.next()
.unwrap()
);
} }
let mut possible_positions = HashSet::new(); let mut possible_positions = HashSet::new();