diff options
| author | Thomas Schmucker <ts@its1.de> | 2024-01-03 13:46:31 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2024-01-03 13:46:31 +0100 |
| commit | 5ea1825b48850a2dd07a14901df13db11d782f5f (patch) | |
| tree | 34718184c8288534aaaaf8d1d43fb5693e56382a | |
| parent | b11265b0cccd1f4c236327529c1e4623931bd2f0 (diff) | |
| download | advent-of-code-5ea1825b48850a2dd07a14901df13db11d782f5f.tar.gz advent-of-code-5ea1825b48850a2dd07a14901df13db11d782f5f.tar.bz2 advent-of-code-5ea1825b48850a2dd07a14901df13db11d782f5f.zip | |
cleanup
| -rw-r--r-- | src/day20.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/day20.cpp b/src/day20.cpp index a17f2f2..f85ac90 100644 --- a/src/day20.cpp +++ b/src/day20.cpp | |||
| @@ -133,14 +133,13 @@ struct OutputModule : public Module { | |||
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | void | 135 | void |
| 136 | part1() | 136 | part1(const vector<string>& input) |
| 137 | { | 137 | { |
| 138 | queue<tuple<string, int, string>> queue; | 138 | queue<tuple<string, int, string>> queue; |
| 139 | map<string, shared_ptr<Module>> modules; | 139 | map<string, shared_ptr<Module>> modules; |
| 140 | 140 | ||
| 141 | modules["output"] = make_shared<OutputModule>("output", queue); | 141 | modules["output"] = make_shared<OutputModule>("output", queue); |
| 142 | 142 | ||
| 143 | const auto input = read_file("data/day20.txt"); | ||
| 144 | for ( const auto& line: input ) { | 143 | for ( const auto& line: input ) { |
| 145 | const auto parts = split(line, " -> "); | 144 | const auto parts = split(line, " -> "); |
| 146 | auto module = parts[0]; | 145 | auto module = parts[0]; |
| @@ -199,14 +198,13 @@ part1() | |||
| 199 | } | 198 | } |
| 200 | 199 | ||
| 201 | void | 200 | void |
| 202 | part2() | 201 | part2(const vector<string>& input) |
| 203 | { | 202 | { |
| 204 | queue<tuple<string, int, string>> queue; | 203 | queue<tuple<string, int, string>> queue; |
| 205 | map<string, shared_ptr<Module>> modules; | 204 | map<string, shared_ptr<Module>> modules; |
| 206 | 205 | ||
| 207 | modules["output"] = make_shared<OutputModule>("output", queue); | 206 | modules["output"] = make_shared<OutputModule>("output", queue); |
| 208 | 207 | ||
| 209 | const auto input = read_file("data/day20.txt"); | ||
| 210 | for ( const auto& line: input ) { | 208 | for ( const auto& line: input ) { |
| 211 | const auto parts = split(line, " -> "); | 209 | const auto parts = split(line, " -> "); |
| 212 | auto module = parts[0]; | 210 | auto module = parts[0]; |
| @@ -289,6 +287,7 @@ part2() | |||
| 289 | int | 287 | int |
| 290 | main() | 288 | main() |
| 291 | { | 289 | { |
| 292 | part1(); | 290 | const auto input = read_file("data/day20.txt"); |
| 293 | part2(); | 291 | part1(input); |
| 292 | part2(input); | ||
| 294 | } | 293 | } |
