1
0

Remove split char parameter from Point2 and Point3 constructors

This commit is contained in:
Stefan Müller
2026-01-26 21:59:12 +01:00
parent d28f2ff79e
commit 8f9356e81e
3 changed files with 24 additions and 11 deletions
+1 -3
View File
@@ -5,13 +5,11 @@ use std::io::BufRead;
pub struct MovieTheater {}
impl MovieTheater {
const POINT_SPLIT_CHAR: char = ',';
// Collects all red tile coordinates.
fn red_tiles<R: BufRead>(reader: R) -> Vec<Point2> {
let mut red_tiles = Vec::new();
for line in reader.lines().map_while(Result::ok) {
red_tiles.push(Point2::from_line(&line, Self::POINT_SPLIT_CHAR));
red_tiles.push(Point2::from_line(&line));
}
red_tiles
}
+3 -4
View File
@@ -8,11 +8,10 @@ pub struct Playground {
}
impl Playground {
const POINT_SPLIT_CHAR: char = ',';
const CIRCUITS_TAKE: usize = 3;
pub fn new(connections: Option<usize>) -> Playground {
Playground {
pub fn new(connections: Option<usize>) -> Self {
Self {
connections: connections.unwrap_or(1000),
}
}
@@ -21,7 +20,7 @@ impl Playground {
fn junction_boxes<R: BufRead>(reader: R) -> Vec<Point3> {
let mut junction_boxes = Vec::new();
for line in reader.lines().map_while(Result::ok) {
junction_boxes.push(Point3::from_line(&line, Self::POINT_SPLIT_CHAR));
junction_boxes.push(Point3::from_line(&line));
}
junction_boxes
}