diff --git a/2019/24.cpp b/2019/24.cpp index 9b9abb9..4be6e90 100644 --- a/2019/24.cpp +++ b/2019/24.cpp @@ -62,23 +62,23 @@ struct Neighbor2 { auto operator()(C3 cd, auto f) const -> void { auto const [c,d] = cd; - auto left_neighbors = [&f](Coord c, std::int64_t d, auto k_, auto k) { - c = k_(c); - if (c.x == 1 && c.y == 0) { + auto left_neighbors = [&](auto k_, auto k) { + auto c_ = k_(c); + if (c_.x == 1 && c_.y == 0) { for (std::int64_t yi = -2; yi <= 2; yi++) { f({k({2,yi}),d+1}); } - } else if (c.x > -2) { - f({k(Left(c)),d}); + } else if (c_.x > -2) { + f({k(Left(c_)),d}); } else { f({k({-1,0}),d-1}); } }; auto id = [](Coord i) { return i; }; - left_neighbors(c, d, id, id); - left_neighbors(c, d, Turn180, Turn180); - left_neighbors(c, d, CW, CCW); - left_neighbors(c, d, CCW, CW); + left_neighbors(id, id); + left_neighbors(Turn180, Turn180); + left_neighbors(CW, CCW); + left_neighbors(CCW, CW); } };