Add solver constants
This commit is contained in:
@@ -5,6 +5,10 @@ use std::io::BufRead;
|
||||
|
||||
pub struct Cafeteria {}
|
||||
|
||||
impl Cafeteria {
|
||||
const INTERVAL_SPLIT_CHAR: char = '-';
|
||||
}
|
||||
|
||||
impl Solver for Cafeteria {
|
||||
const PUZZLE_INDEX: u8 = 5;
|
||||
const PUZZLE_NAME: &'static str = "Cafeteria";
|
||||
@@ -17,7 +21,8 @@ impl Solver for Cafeteria {
|
||||
.lines()
|
||||
.map_while(|x| x.ok().filter(|s| !s.is_empty()))
|
||||
{
|
||||
let values: Vec<u64> = line.split('-').map_while(|s| s.parse().ok()).collect();
|
||||
// TODO: This code should move into new common::interval::MultiInterval struct.
|
||||
let values: Vec<u64> = line.split(Self::INTERVAL_SPLIT_CHAR).map_while(|s| s.parse().ok()).collect();
|
||||
let mut interval = Interval::new(values[0], values[1]);
|
||||
|
||||
let mut to_delete = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user