aboutsummaryrefslogtreecommitdiff
path: root/src/2019/day10/aoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2019/day10/aoc.cpp')
-rw-r--r--src/2019/day10/aoc.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/2019/day10/aoc.cpp b/src/2019/day10/aoc.cpp
index 4d200f4..fbcb049 100644
--- a/src/2019/day10/aoc.cpp
+++ b/src/2019/day10/aoc.cpp
@@ -4,7 +4,29 @@
namespace aoc2019 {
std::pair<int, int> day10(line_view file) {
- return {0, 0};
+ belt b;
+ int r{0};
+ per_line(file, [&b, &r](line_view lv) {
+ b.load(lv, r++);
+ return true;
+ });
+
+ // b.print();
+
+ int observe{0};
+ int max{0};
+
+ b.iterate([&observe, &max, &b](belt::pos p){
+ if (b.get(p) == '#') {
+ observe = 0;
+ b.count(p, &observe);
+ if (observe > max) {
+ max = observe;
+ }
+ }
+ });
+
+ return {max, 0};
}
} // namespace aoc2019