mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Remove code duplication.
This commit is contained in:
@@ -45,15 +45,12 @@ impl Day12 {
|
||||
}
|
||||
|
||||
fn read_input(&mut self, input: &mut Read) -> State {
|
||||
let mut state = Vec::new();
|
||||
let state;
|
||||
let mut reader = BufReader::new(input);
|
||||
{
|
||||
let mut line = String::new();
|
||||
reader.read_line(&mut line).unwrap();
|
||||
|
||||
for (idx, c) in line.trim().chars().skip("initial state: ".len()).enumerate() {
|
||||
state.push((idx as i64, char_bool(c)));
|
||||
}
|
||||
state = state_from_string(&line["initial state:".len()..line.len()].trim(), 0);
|
||||
}
|
||||
|
||||
for line in reader.lines() {
|
||||
|
||||
Reference in New Issue
Block a user