day 16 finished

This commit is contained in:
Rüdiger Ludwig 2023-07-26 22:09:11 +02:00
parent daa8b6b1d0
commit 6f3e94c5d1
6 changed files with 1081 additions and 94 deletions

View file

@ -1,7 +1,7 @@
use super::template::{DayTrait, ResultType};
use crate::common::pos::Pos;
use itertools::Itertools;
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use regex::Regex;
use std::{collections::HashSet, num::ParseIntError};
use thiserror::Error;
@ -209,9 +209,8 @@ struct Sensor {
radius: i64,
}
lazy_static! {
static ref SENSOR: Regex = Regex::new(r"x=(-?\d+), y=(-?\d+).*x=(-?\d+), y=(-?\d+)").unwrap();
}
static SENSOR: Lazy<Regex> =
Lazy::new(|| Regex::new(r"x=(-?\d+), y=(-?\d+).*x=(-?\d+), y=(-?\d+)").unwrap());
impl Sensor {
pub fn parse(line: &str) -> Result<(Sensor, Pos<i64>), SensorError> {