aboutsummaryrefslogtreecommitdiff
path: root/src/2017/day22/aoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2017/day22/aoc.cpp')
-rw-r--r--src/2017/day22/aoc.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/2017/day22/aoc.cpp b/src/2017/day22/aoc.cpp
index 8adacb1..8a70bc8 100644
--- a/src/2017/day22/aoc.cpp
+++ b/src/2017/day22/aoc.cpp
@@ -102,8 +102,8 @@ vpos burst2(std::map<node22, virus_state>& nodes, vpos p, int* c) {
nodes.insert({{p.x, p.y}, v_weakened});
} else {
if (s == v_weakened) {
- it->second = v_infected;
*c += 1;
+ it->second = v_infected;
}
if (s == v_infected) {
@@ -141,10 +141,9 @@ static void part1(std::map<node22, virus_state> nodes, int* c) {
static void part2(std::map<node22, virus_state> nodes, int* c) {
vpos p{0, 0, f_up};
- for (int i = 0; i < 100; i++) {
+ for (int i = 0; i < 10000000; i++) {
p = burst2(nodes, p, c);
}
- printf("%d\n", *c);
}
std::pair<int64_t, int64_t> day22(line_view file) {
@@ -163,7 +162,7 @@ std::pair<int64_t, int64_t> day22(line_view file) {
// for (auto& n : infected) {
// printf("%d,%d\n", n.x, n.y);
// }
- return {t0, 0};
+ return {t0, t1};
}
} // namespace aoc2017