diff --git a/goap.cpp b/goap.cpp index 24f30bb..0ab6d64 100644 --- a/goap.cpp +++ b/goap.cpp @@ -106,7 +106,6 @@ namespace ai { } ActionPlan plan_actions(std::vector& actions, State start, State goal) { - int loop_count = 0; std::unordered_map open_set; std::unordered_map came_from; std::unordered_map g_score; @@ -121,12 +120,10 @@ namespace ai { open_set.insert_or_assign(current, h(start, goal)); while(!open_set.empty()) { - loop_count++; // current := the node in openSet having the lowest fScore[] value current = find_lowest(open_set, f_score); if(is_subset(current.state, goal)) { - fmt::println("YES CLOSED COUNT: {}", loop_count); return {true, reconstruct_path(came_from, current.action)}; } @@ -139,13 +136,7 @@ namespace ai { if(!neighbor_action.can_effect(current.state)) continue; auto neighbor = neighbor_action.apply_effect(current.state); - if(closed_set.contains(neighbor)) { - fmt::println("closed_set: {}, open_set: {}, f_score: {}", - closed_set.size(), open_set.size(), f_score.size()); - continue; - } else { - loop_count++; - } + if(closed_set.contains(neighbor)) continue; int d_score = d(current.state, neighbor) + neighbor_action.cost; @@ -170,7 +161,6 @@ namespace ai { } } - fmt::println("YES CLOSED COUNT: {}", loop_count); return {is_subset(current.state, goal), reconstruct_path(came_from, current.action)}; } }