static Koyone::GridMap iterarion(Koyone::GridMap const& map, int iter) { std::vector<Koyone::GridMap> npws(iter); npws[0] = map; for(int i(0); i < iter - 1; ++i) { npws[i+1].reserve(npws[i].size()); for(auto const& e: npws[i]) { for(auto const& e2: nextPossibleWorld(e.first)) npws[i+1].emplace_back(e2.first, e.second); } if(npws[i+1].empty()) return npws[i]; } return npws[iter - 1]; }
static Koyone::GridMap iterarion(Koyone::GridMap&& map, int ITERATION){ Koyone::GridMap npws[ITERATION]; npws[0] = map; for(int i(0); i < ITERATION - 1; ++i){ npws[i+1].reserve(npws[i].size()); for(auto const& e: npws[i]){ for(auto const& e2: nextPossibleWorld(e.first)) npws[i+1].emplace_back(e2.first, e.second); } if(npws[i+1].empty()) return npws[i]; } return npws[ITERATION - 1]; }