diff options
author | kaiwu <kaiwu2004@gmail.com> | 2023-02-13 14:32:16 +0800 |
---|---|---|
committer | kaiwu <kaiwu2004@gmail.com> | 2023-02-13 14:32:16 +0800 |
commit | 51acfc18dfd36fe4eb018a2626893c0e8401ab49 (patch) | |
tree | 9e54f5bb4f6982a4d7ae90bb6daf5c9d6da801d6 /src/2017/day19/aoc.cpp | |
parent | 18e9b3dd35e16cb2393ffac02b4c88be89274273 (diff) | |
download | advent-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.cpp | 8 |
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 |