aboutsummaryrefslogtreecommitdiff
path: root/src/2017/day19/aoc.cpp
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2023-02-13 14:32:16 +0800
committerkaiwu <kaiwu2004@gmail.com>2023-02-13 14:32:16 +0800
commit51acfc18dfd36fe4eb018a2626893c0e8401ab49 (patch)
tree9e54f5bb4f6982a4d7ae90bb6daf5c9d6da801d6 /src/2017/day19/aoc.cpp
parent18e9b3dd35e16cb2393ffac02b4c88be89274273 (diff)
downloadadvent-of-code-51acfc18dfd36fe4eb018a2626893c0e8401ab49.tar.gz
advent-of-code-51acfc18dfd36fe4eb018a2626893c0e8401ab49.zip
2017 day19
Diffstat (limited to 'src/2017/day19/aoc.cpp')
-rw-r--r--src/2017/day19/aoc.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/2017/day19/aoc.cpp b/src/2017/day19/aoc.cpp
index 9336fdb..a9511f4 100644
--- a/src/2017/day19/aoc.cpp
+++ b/src/2017/day19/aoc.cpp
@@ -46,7 +46,7 @@ static heading next(heading h, alpha_grid& g) {
return next(h);
}
-static void move(heading h, alpha_grid& g, std::string& alpha) {
+static void move(heading h, alpha_grid& g, std::string& alpha, int* count) {
while (true) {
char c = g.get(h.p);
if (c == ' ')
@@ -55,6 +55,7 @@ static void move(heading h, alpha_grid& g, std::string& alpha) {
alpha.push_back(c);
}
h = next(h, g);
+ *count += 1;
}
}
@@ -69,7 +70,8 @@ std::pair<std::string, int64_t> day19(line_view file) {
heading start = {g.start, direction::down};
std::string alpha{""};
- move(start, g, alpha);
- return {alpha, 0};
+ int count{0};
+ move(start, g, alpha, &count);
+ return {alpha, count};
}
} // namespace aoc2017