Fixed some bugs when running "run all", as it was trying to create instances with empty input for some reason
This commit is contained in:
@@ -15,7 +15,7 @@ impl Day10 {
|
||||
Day10 {
|
||||
map: Grid {
|
||||
data: input.lines().join("").chars().map(|c| (c as u8) - b'0').collect(),
|
||||
width: input.lines().next().unwrap().len(),
|
||||
width: input.lines().next().map(|l| l.len()).unwrap_or(0),
|
||||
default: Some(255)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ impl ClawMachine {
|
||||
impl Day13 {
|
||||
|
||||
pub fn create(input: String) -> Self {
|
||||
|
||||
Day13 {
|
||||
machines: input.split("\n\n")
|
||||
.filter(|c| !c.is_empty())
|
||||
.map(|c| {
|
||||
let mut c_lines = c.split("\n");
|
||||
let button_a = c_lines.next().unwrap()["Button A: X+".len()..].split_once(", ").map(|(x, y)| Coord::new(x.parse::<i64>().unwrap(), y[2..].parse::<i64>().unwrap())).unwrap();
|
||||
|
||||
@@ -2,9 +2,9 @@ use std::collections::HashMap;
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::{day_solver::DaySolver, util::{Coord, Grid}};
|
||||
#[cfg(test)]
|
||||
use crate::util::read_file;
|
||||
use crate::{day_solver::DaySolver, util::{Coord, Grid}};
|
||||
|
||||
pub struct Day8 {
|
||||
map: Grid<char>
|
||||
@@ -14,7 +14,7 @@ impl Day8 {
|
||||
|
||||
pub fn create(input: String) -> Self {
|
||||
|
||||
return Day8 {
|
||||
Day8 {
|
||||
map: Grid::parse(input, None)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user