mirror of
https://github.com/LeMoonStar/AoC24.git
synced 2025-07-08 00:10:00 +02:00
🚨 Day 4: Fixed some warnings
This commit is contained in:
parent
d6ca0b2b0c
commit
11b61a2527
1 changed files with 6 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
use crate::dprintln;
|
||||||
|
|
||||||
use super::{Answer, Day, DayImpl};
|
use super::{Answer, Day, DayImpl};
|
||||||
|
|
||||||
const CURRENT_DAY: u8 = 4;
|
const CURRENT_DAY: u8 = 4;
|
||||||
|
@ -28,7 +30,7 @@ impl LetterWall {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_upper_left_of_xmas(&self, x: usize, y: usize) -> Option<Direction> {
|
fn is_upper_left_of_xmas(&self, x: usize, y: usize) -> Option<Direction> {
|
||||||
match(
|
match(
|
||||||
self.at( x, y), self.at( x+1, y), self.at( x+2, y), self.at( x+3, y),
|
self.at( x, y), self.at( x+1, y), self.at( x+2, y), self.at( x+3, y),
|
||||||
self.at( x, y+1), self.at( x+1, y+1), self.at( x+2, y+1), self.at( x+3, y+1),
|
self.at( x, y+1), self.at( x+1, y+1), self.at( x+2, y+1), self.at( x+3, y+1),
|
||||||
|
@ -82,7 +84,7 @@ impl LetterWall {
|
||||||
_, _, Some('A'), _,
|
_, _, Some('A'), _,
|
||||||
_, Some('M'), _, _,
|
_, Some('M'), _, _,
|
||||||
Some('X'), _, _, _
|
Some('X'), _, _, _
|
||||||
) => Some(Direction::SouthWest),
|
) => Some(Direction::NorthEast),
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,8 +93,8 @@ impl LetterWall {
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for y in 0..self.0.len(){
|
for y in 0..self.0.len(){
|
||||||
for x in 0..self.0[0].len() {
|
for x in 0..self.0[0].len() {
|
||||||
if let Some(dir) = self.is_upper_left_of_xmas(x, y) {
|
if let Some(_dir) = self.is_upper_left_of_xmas(x, y) {
|
||||||
println!("FOUND AT {} {} '{}' - DIR: {:?}", x, y, self.0[y][x], dir);
|
dprintln!("FOUND AT {} {} '{}' - DIR: {:?}", x, y, self.0[y][x], _dir);
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue