From aa924e801d45a84b4c4d7ad2fd2a7bdcfc435a8e Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Sun, 27 Dec 2020 21:57:27 -0500 Subject: [PATCH] Minor cleanup of day 24 --- day24/day24.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/day24/day24.cpp b/day24/day24.cpp index 9a9fc1f..12f89e3 100644 --- a/day24/day24.cpp +++ b/day24/day24.cpp @@ -151,8 +151,6 @@ int part2(const std::vector> &input) { } } - next.clear(); - for (auto &entry : flipped) { auto neighbors = getNeighbors(entry.first); int numFlippedNeighbors = @@ -164,12 +162,11 @@ int part2(const std::vector> &input) { bool nextState = entry.second; if (entry.second && (numFlippedNeighbors == 0 || numFlippedNeighbors > 2)) { nextState = false; - next.emplace(entry.first, false); } else if (!entry.second && numFlippedNeighbors == 2) { nextState = true; } - next.emplace(entry.first, nextState); + next[entry.first] = nextState; } std::swap(flipped, next);