Question: int find _ path ( const char stage [ ] [ MAX _ NUM _ FLOOR ] [ MAX _ ENCOUNTER _ LENGTH ] ,

int find_path(const char stage[][MAX_NUM_FLOOR][MAX_ENCOUNTER_LENGTH], int num_tower, int current_tower,
int num_floor, int explored_floor_count, int explored_floor[],
int strength, int floor_path[], int stage_path[][MAX_NUM_FLOOR]){
// TODO Base case 1: If the current tower is out of bounds, return the strength
if (current_tower >= num_tower)
return strength;
// End of TODO
// TODO Base case 2: If all floors have been explored, write the explored floor to floor path (backtracking), then return the strength
if (explored_floor_count == num_floor)
{
copy_floor (floor_path,explored_floor);
return strength;
}
// End of TODO
// Recursive case
int highest_strength =-1;
int best_floor_path[MAX_NUM_FLOOR];
// Try every unexplored floor in the current tower.
for (int i=0; i highest_strength){
highest_strength = recursion_result;
copy_floor(best_floor_path, recursion_floor_path);
}
}
// If the current tower is fully explored, backtrack the best path for the current floor and call the recursive function for the next tower
if (explored_floor_count ==0){
// TODO: Backtrack the best path for the current tower using a line of code (Use copy_floor())
copy_floor(stage_path[current_tower],best_floor_path); //copy the current explored result to best path array
// End of TODO
int floor_explored[MAX_NUM_FLOOR];
int floor_path[MAX_NUM_FLOOR];
// TODO: Complete the recursive function call to move to the next tower
find_path(stage,num_tower,current_tower +1,num_floor, 0,floor_explored,strength,floor_path,stage_path); //current tower +1 to next tower, explored floor count change to 0 in new tower
// End of TODO
}
// TODO: Backtrack the best path for the current floor selection using a line of code (Use copy_floor())
copy_floor(floor_path,best_floor_path);
// End of TODO
return highest_strength;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!