@@ -74,9 +74,9 @@ Solution astar::search_astar(const Board& initial_board, const vector<Piece>& in
7474 AStarSearchNode initial_astar_node (initial_pieces, initial_board, {}, initial_g_cost, initial_h_cost);
7575 pq.push (initial_astar_node);
7676
77- godot::UtilityFunctions::print (" ASTAR: Initial g_cost: " + godot::String::num_int64 (initial_astar_node.actual_g_cost ) +
78- " , h_cost: " + godot::String::num_int64 (initial_astar_node.h_cost ) +
79- " , f_cost: " + godot::String::num_int64 (initial_astar_node.val )); // val dari base class adalah f_cost
77+ // godot::UtilityFunctions::print("ASTAR: Initial g_cost: " + godot::String::num_int64(initial_astar_node.actual_g_cost) +
78+ // ", h_cost: " + godot::String::num_int64(initial_astar_node.h_cost) +
79+ // ", f_cost: " + godot::String::num_int64(initial_astar_node.val)); // val dari base class adalah f_cost
8080
8181 while (!pq.empty ()) {
8282 AStarSearchNode current_node = pq.top ();
@@ -89,32 +89,32 @@ Solution astar::search_astar(const Board& initial_board, const vector<Piece>& in
8989 }
9090 visited_states.insert (current_state_str);
9191
92- godot::UtilityFunctions::print (" ASTAR: Exploring node. " +
93- godot::String (" f(n):" ) + godot::String::num_int64 (current_node.val ) + // f_cost dari base.val
94- godot::String (" , g(n):" ) + godot::String::num_int64 (current_node.actual_g_cost ) +
95- godot::String (" , h(n):" ) + godot::String::num_int64 (current_node.h_cost ) +
96- " . Path length: " + godot::String::num_int64 (static_cast <int64_t >(current_node.path .size ()))); // path dari base
92+ // godot::UtilityFunctions::print("ASTAR: Exploring node. " +
93+ // godot::String("f(n):") + godot::String::num_int64(current_node.val) + // f_cost dari base.val
94+ // godot::String(", g(n):") + godot::String::num_int64(current_node.actual_g_cost) +
95+ // godot::String(", h(n):") + godot::String::num_int64(current_node.h_cost) +
96+ // ". Path length: " + godot::String::num_int64(static_cast<int64_t>(current_node.path.size()))); // path dari base
9797
98- if (current_node.piece_moved != ' ' ) { // piece_moved dari base
99- Coordinates new_pos_for_log = {-1 , -1 };
100- for (const auto & p_state : current_node.pieces ) { // pieces dari base
101- if (p_state.id == current_node.piece_moved ) {
102- new_pos_for_log = p_state.coordinates ;
103- break ;
104- }
105- }
106- godot::UtilityFunctions::print (" Moved piece: " , godot::String::utf8 (¤t_node.piece_moved , 1 ),
107- " from (" , current_node.original_position .x , " ," , current_node.original_position .y ,
108- " ) to (" , new_pos_for_log.x , " ," , new_pos_for_log.y , " )" ); // original_position dari base
109- }
98+ // if (current_node.piece_moved != ' ') { // piece_moved dari base
99+ // Coordinates new_pos_for_log = {-1, -1};
100+ // for(const auto& p_state : current_node.pieces) { // pieces dari base
101+ // if (p_state.id == current_node.piece_moved) {
102+ // new_pos_for_log = p_state.coordinates;
103+ // break;
104+ // }
105+ // }
106+ // godot::UtilityFunctions::print("Moved piece: ", godot::String::utf8(¤t_node.piece_moved, 1),
107+ // " from (", current_node.original_position.x, ",", current_node.original_position.y,
108+ // ") to (", new_pos_for_log.x, ",", new_pos_for_log.y, ")"); // original_position dari base
109+ // }
110110
111111 if (Utils::is_exit (current_node.board , current_node.pieces )) { // board dan pieces dari base
112112 result.is_solved = true ;
113113 result.moves = current_node.path ; // path dari base
114- godot::UtilityFunctions::print (" ASTAR: Solution Found! Optimal steps (g_cost): " +
115- godot::String::num_int64 (current_node.actual_g_cost ) + " . Total moves: " +
116- godot::String::num_int64 (result.moves .size ()) + " . Nodes visited: " +
117- godot::String::num_int64 (static_cast <int64_t >(result.node )));
114+ // godot::UtilityFunctions::print("ASTAR: Solution Found! Optimal steps (g_cost): " +
115+ // godot::String::num_int64(current_node.actual_g_cost) + ". Total moves: " +
116+ // godot::String::num_int64(result.moves.size()) + ". Nodes visited: " +
117+ // godot::String::num_int64(static_cast<int64_t>(result.node)));
118118 break ;
119119 }
120120
@@ -131,8 +131,8 @@ Solution astar::search_astar(const Board& initial_board, const vector<Piece>& in
131131 auto time_end = chrono::high_resolution_clock::now ();
132132 result.duration = chrono::duration<double , milli>(time_end - time_start);
133133
134- if (!result.is_solved ) {
135- godot::UtilityFunctions::print (" ASTAR: No solution found. Nodes visited: " + godot::String::num_int64 (static_cast <int64_t >(result.node )));
136- }
134+ // if (!result.is_solved) {
135+ // godot::UtilityFunctions::print("ASTAR: No solution found. Nodes visited: " + godot::String::num_int64(static_cast<int64_t>(result.node)));
136+ // }
137137 return result;
138138}
0 commit comments