diff --git a/day14/common.rs b/day14/common.rs new file mode 100644 index 0000000..dba6ef1 --- /dev/null +++ b/day14/common.rs @@ -0,0 +1,163 @@ +// Copyright 2022 Christian Ulrich +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use std::io; +use std::ops::Range; + +pub struct CaveScan { + tiles: Vec>, + origin: (usize, usize), + x_window: Range, + y_window: Range, +} + +pub struct Falls<'a> { + scan: &'a mut CaveScan, +} + +impl CaveScan { + fn insert_hline(&mut self, start: (usize, usize), end: (usize, usize)) { + assert!(start.1 == end.1); + for i in start.0..=end.0 { + self.set_tile((i, start.1), true); + } + } + + fn insert_vline(&mut self, start: (usize, usize), end: (usize, usize)) { + assert!(start.0 == end.0); + for i in start.1..=end.1 { + self.set_tile((start.0, i), true); + } + } + + pub fn from_stdin(origin: (usize, usize)) -> Result { + const ERROR: &str = "input file contains invalid line"; + + let mut result = Self { + tiles: vec![vec![false]], + origin: origin, + x_window: origin.0..origin.0, + y_window: origin.1..origin.1, + }; + for line in io::stdin().lines() { + let line = match line { + Ok(line) if { line.len() > 0 } => line, + _ => break, + }; + let points: Result, _> = line + .split(" -> ") + .map(|part| part.split_once(',').ok_or(ERROR)) + .map(|split| { + Ok(( + split?.0.parse().map_err(|_| ERROR)?, + split?.1.parse().map_err(|_| ERROR)?, + )) + }) + .collect(); + for points in points?.windows(2) { + let start = points.get(0).ok_or(ERROR)?; + let end = points.get(1).ok_or(ERROR)?; + match (start, end) { + (s, e) if { s.0 == e.0 && s.1 > e.1 } => result.insert_vline(*e, *s), + (s, e) if { s.0 == e.0 } => result.insert_vline(*s, *e), + (s, e) if { s.1 == e.1 && s.0 > e.0 } => result.insert_hline(*e, *s), + (s, e) if { s.1 == e.1 } => result.insert_hline(*s, *e), + _ => return Err(ERROR), + } + } + } + Ok(result) + } + + fn bottom(&self) -> usize { + self.tiles.len() + } + + fn tile(&self, pos: (usize, usize)) -> bool { + if pos.0 < self.x_window.start + || pos.0 > self.x_window.end + || pos.1 < self.y_window.start + || pos.1 > self.y_window.end + { + return false; + } + self.tiles[pos.1 - self.y_window.start][pos.0 - self.x_window.start] + } + + fn set_tile(&mut self, pos: (usize, usize), value: bool) { + if !self.x_window.contains(&pos.0) { + let new_x_window = + usize::min(self.x_window.start, pos.0)..usize::max(self.x_window.end, pos.0); + for line in self.tiles.iter_mut() { + let old_line = line.clone(); + *line = vec![false; new_x_window.len() + 1]; + let x_offset = self.x_window.start - new_x_window.start; + line[x_offset..old_line.len() + x_offset].copy_from_slice(&old_line[..]); + } + self.x_window = new_x_window; + } + if !self.y_window.contains(&pos.1) { + let new_y_window = + usize::min(self.y_window.start, pos.1)..usize::max(self.y_window.end, pos.1); + let head = vec![ + vec![false; self.x_window.len() + 1]; + new_y_window.start - self.y_window.start + ]; + let tail = + vec![vec![false; self.x_window.len() + 1]; new_y_window.end - self.y_window.end]; + self.tiles = [&head[..], &self.tiles[..], &tail[..]].concat(); + self.y_window = new_y_window; + } + self.tiles[pos.1 - self.y_window.start][pos.0 - self.x_window.start] = value; + } + + fn step_down(&self, origin: (usize, usize)) -> Option<(usize, usize)> { + let down_pos = (origin.0, origin.1.checked_add(1)?); + let down_left_pos = (origin.0.checked_sub(1)?, down_pos.1); + let down_right_pos = (origin.0.checked_add(1)?, down_pos.1); + + let result = match ( + self.tile(down_left_pos), + self.tile(down_pos), + self.tile(down_right_pos), + ) { + (_, false, _) => Some(down_pos), + (false, true, _) => Some(down_left_pos), + (true, true, false) => Some(down_right_pos), + (true, true, true) => None, + }; + result + } + + pub fn falls(&mut self) -> Falls { + Falls { scan: self } + } +} + +impl Iterator for Falls<'_> { + type Item = (usize, usize); + + fn next(&mut self) -> Option { + let mut result = self.scan.origin; + while let Some(pos) = self.scan.step_down(result) { + result = pos; + if result.1 == self.scan.bottom() { + return Some((result.0, usize::MAX)); + } + } + self.scan.set_tile(result, true); + Some(result) + } +} diff --git a/day14/input b/day14/input new file mode 100644 index 0000000..538ffc5 --- /dev/null +++ b/day14/input @@ -0,0 +1,178 @@ +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +534,94 -> 538,94 +519,92 -> 523,92 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +499,27 -> 499,28 -> 515,28 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +525,88 -> 529,88 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +533,116 -> 537,116 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +523,70 -> 528,70 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +540,126 -> 540,127 -> 543,127 -> 543,126 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +560,161 -> 565,161 +540,94 -> 544,94 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +554,167 -> 559,167 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +533,122 -> 533,123 -> 541,123 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +543,164 -> 548,164 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +525,92 -> 529,92 +525,119 -> 537,119 -> 537,118 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +530,70 -> 535,70 +516,94 -> 520,94 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +525,119 -> 537,119 -> 537,118 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +528,90 -> 532,90 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +533,67 -> 538,67 +546,161 -> 551,161 +537,70 -> 542,70 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +532,61 -> 537,61 +499,27 -> 499,28 -> 515,28 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +534,90 -> 538,90 +531,88 -> 535,88 +556,158 -> 561,158 +525,61 -> 530,61 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +533,122 -> 533,123 -> 541,123 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +557,164 -> 562,164 +552,155 -> 557,155 +531,92 -> 535,92 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +547,167 -> 552,167 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +561,167 -> 566,167 +522,64 -> 527,64 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +519,67 -> 524,67 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +550,164 -> 555,164 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +516,70 -> 521,70 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +536,64 -> 541,64 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +539,110 -> 543,110 +529,64 -> 534,64 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +528,86 -> 532,86 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +540,126 -> 540,127 -> 543,127 -> 543,126 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +545,116 -> 549,116 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +568,167 -> 573,167 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +553,161 -> 558,161 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +540,67 -> 545,67 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +546,141 -> 546,144 -> 541,144 -> 541,152 -> 554,152 -> 554,144 -> 550,144 -> 550,141 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +522,90 -> 526,90 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +528,58 -> 533,58 +549,158 -> 554,158 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +523,44 -> 523,48 -> 517,48 -> 517,55 -> 530,55 -> 530,48 -> 525,48 -> 525,44 +526,67 -> 531,67 +540,167 -> 545,167 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +544,170 -> 544,174 -> 536,174 -> 536,182 -> 554,182 -> 554,174 -> 549,174 -> 549,170 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +541,130 -> 541,133 -> 537,133 -> 537,138 -> 548,138 -> 548,133 -> 545,133 -> 545,130 +540,126 -> 540,127 -> 543,127 -> 543,126 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +542,113 -> 546,113 +528,94 -> 532,94 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 +522,94 -> 526,94 +539,116 -> 543,116 +544,70 -> 549,70 +542,107 -> 542,104 -> 542,107 -> 544,107 -> 544,101 -> 544,107 -> 546,107 -> 546,100 -> 546,107 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +536,113 -> 540,113 +537,92 -> 541,92 +507,41 -> 507,39 -> 507,41 -> 509,41 -> 509,35 -> 509,41 -> 511,41 -> 511,34 -> 511,41 -> 513,41 -> 513,40 -> 513,41 -> 515,41 -> 515,38 -> 515,41 -> 517,41 -> 517,31 -> 517,41 -> 519,41 -> 519,33 -> 519,41 -> 521,41 -> 521,32 -> 521,41 -> 523,41 -> 523,39 -> 523,41 +513,83 -> 513,76 -> 513,83 -> 515,83 -> 515,73 -> 515,83 -> 517,83 -> 517,80 -> 517,83 -> 519,83 -> 519,82 -> 519,83 -> 521,83 -> 521,80 -> 521,83 -> 523,83 -> 523,73 -> 523,83 -> 525,83 -> 525,81 -> 525,83 -> 527,83 -> 527,81 -> 527,83 -> 529,83 -> 529,74 -> 529,83 +564,164 -> 569,164 +490,23 -> 490,17 -> 490,23 -> 492,23 -> 492,14 -> 492,23 -> 494,23 -> 494,20 -> 494,23 -> 496,23 -> 496,18 -> 496,23 -> 498,23 -> 498,19 -> 498,23 -> 500,23 -> 500,20 -> 500,23 -> 502,23 -> 502,17 -> 502,23 -> 504,23 -> 504,14 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,15 -> 508,23 + diff --git a/day14/part1.rs b/day14/part1.rs new file mode 100644 index 0000000..44ae607 --- /dev/null +++ b/day14/part1.rs @@ -0,0 +1,33 @@ +// Copyright 2022 Christian Ulrich +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// usage: ./part1 < input + +pub mod common; + +use common::CaveScan; + +fn main() -> Result<(), &'static str> { + let mut scan = CaveScan::from_stdin((500, 0))?; + let mut result = 0; + for end_pos in scan.falls() { + match end_pos { + (_, usize::MAX) => break, + _ => result += 1, + } + } + println!("{result}"); + Ok(()) +} diff --git a/day14/testinput b/day14/testinput new file mode 100644 index 0000000..4e87bb5 --- /dev/null +++ b/day14/testinput @@ -0,0 +1,2 @@ +498,4 -> 498,6 -> 496,6 +503,4 -> 502,4 -> 502,9 -> 494,9