Add solver constants
This commit is contained in:
@@ -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(_) => {
|
||||
|
||||
Reference in New Issue
Block a user