adventofcode

git clone https://git.ce9e.org/adventofcode.git

commit
a76fbf456609949af458fdc08fa7c435c7b48142
parent
2f2633d5646d51dd6806032cf152e70c7957278c
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-12-19 09:56
2023-12-18 expanation

Diffstat

M 2023/18/solution.rs 15 +++++++++++++++

1 files changed, 15 insertions, 0 deletions


diff --git a/2023/18/solution.rs b/2023/18/solution.rs

@@ -40,6 +40,21 @@ fn parse_input() -> (Vec<(Dir, i64)>, Vec<(Dir, i64)>) {
   40    40 }
   41    41 
   42    42 fn count(border: &Vec<(Dir, i64)>) -> i64 {
   -1    43     // https://en.wikipedia.org/wiki/Shoelace_formula
   -1    44     //
   -1    45     // ######|
   -1    46     // ######|
   -1    47     // ——####|
   -1    48     // ..####|
   -1    49     // ..####|
   -1    50     // ####+—O
   -1    51     // ####|..
   -1    52     // —#####|
   -1    53     // .#####|
   -1    54     // .—————O
   -1    55     //
   -1    56     // + and O cancel each other out, but there must be one extra O
   -1    57 
   43    58     let mut x = 0;
   44    59     let mut sum = 0;
   45    60     let mut edge = 0;