aboutsummaryrefslogtreecommitdiff
path: root/src/2022/day23/aoc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/2022/day23/aoc.cpp')
-rw-r--r--src/2022/day23/aoc.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/2022/day23/aoc.cpp b/src/2022/day23/aoc.cpp
index 1b5a9e6..1d60f78 100644
--- a/src/2022/day23/aoc.cpp
+++ b/src/2022/day23/aoc.cpp
@@ -86,6 +86,10 @@ static struct elf_test {
elf_move m;
} moves[5] = {{eight, nomove}, {north_three, north}, {south_three, south}, {west_three, west}, {east_three, east}};
+bool duplicate(elf e, const std::vector<elf>& elfs) {
+ return false;
+}
+
std::vector<elf> round(int i, const std::vector<elf>& elfs, const std::set<elf>& elves) {
std::vector<elf> next;
for (auto& e : elfs) {
@@ -103,6 +107,11 @@ std::vector<elf> round(int i, const std::vector<elf>& elfs, const std::set<elf>&
}
// check duplicate of next
+ for(size_t i = 0; i < next.size(); i++) {
+ if (duplicate(next[i], next)) {
+ next[i] = elfs[i]; // stay put
+ }
+ }
return next;
}