aboutsummaryrefslogtreecommitdiff
path: root/src/2016/day22/aoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2016/day22/aoc.cpp')
-rw-r--r--src/2016/day22/aoc.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/2016/day22/aoc.cpp b/src/2016/day22/aoc.cpp
index b4201e3..0a48c4e 100644
--- a/src/2016/day22/aoc.cpp
+++ b/src/2016/day22/aoc.cpp
@@ -24,14 +24,23 @@ void find_pairs(size_t x, const std::vector<grid_node>& ns, int* count) {
std::pair<int64_t, int64_t> day22(line_view file) {
std::vector<grid_node> ns;
+ int maxx{INT32_MIN};
+ int maxy{INT32_MIN};
- per_line(file, [&ns](line_view lv) {
+ per_line(file, [&ns, &maxx, &maxy](line_view lv) {
if (*lv.line == '/') {
- ns.emplace_back(lv);
+ grid_node n{lv};
+ maxx = std::max(maxx, n.x);
+ maxy = std::max(maxy, n.y);
+ ns.emplace_back(n);
}
return true;
});
+ storage_grid grid(maxx + 1, maxy + 1);
+ grid.load(ns);
+ grid.print();
+
// std::sort(ns.begin(), ns.end());
// for (auto& n : ns) {
// n.print();