1
0

Add solver constants

This commit is contained in:
Stefan Müller
2025-12-09 10:54:02 +01:00
parent b981b0b5fe
commit 77743a16dd
4 changed files with 18 additions and 4 deletions
+5 -1
View File
@@ -4,6 +4,10 @@ use std::io::BufRead;
pub struct TrashCompactor {}
impl TrashCompactor {
const NUMBER_SPLIT_CHAR: char = ' ';
}
impl Solver for TrashCompactor {
const PUZZLE_INDEX: u8 = 6;
const PUZZLE_NAME: &'static str = "Trash Compactor";
@@ -12,7 +16,7 @@ impl Solver for TrashCompactor {
let mut part1 = 0;
let mut grid = Grid::new(0, 0);
for line in reader.lines().map_while(Result::ok) {
let v: Vec<&str> = line.split(' ').filter(|s| !s.is_empty()).collect();
let v: Vec<&str> = line.split(Self::NUMBER_SPLIT_CHAR).filter(|s| !s.is_empty()).collect();
match v[0].parse::<u32>() {
Ok(_) => grid.push_row(v.iter().map(|n| n.parse::<u64>().unwrap()).collect()),
Err(_) => {