diff options
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 |