Question: #include #include #include GRAPH _ SEARCH.h #include data _ types.h int main ( ) { Node root, * goal; State * goal _
#include
#include
#include "GRAPHSEARCH.h
#include "datatypes.h
int main
Node root, goal;
State goalstate NULL;
enum METHODS method;
int MaxLevel, level;
float alpha;
This part must be updated if a new algorithm is added.
printf BreastFirst Search
;
printf UniformCost Search
;
printf DepthFirst Search
;
printf DepthLimited Search
;
printf Iterative Deepening Search
;
printf Greedy Search
;
printf A Search
;
printf Generalized A Search
;
printfSelect a method to solve the problem: ;
scanfd &method;
ifmethodDepthLimitedSearch
printfEnter maximum level for depthlimited search : ;
scanfd &MaxLevel;
ifmethodGeneralizedAStarSearch
printfEnter value of alpha for Generalized A Search : ;
scanff α
Creating the root node
root.parent NULL;
root.pathcost ;
root.action NOACTION; The program will not use this part. NOACTION
root.NumberofChild ;
printf SELECTION OF INITIAL STATE
;
root.state CreateState;
ifPREDETERMINEDGOALSTATE User will determine the goal state if it is true
printf SELECTION OF GOAL STATE
;
goalstate CreateState;
ifmethodGreedySearch methodAStarSearch methodGeneralizedAStarSearch
root.state.hn ComputeHeuristicFunction&rootstate goalstate;
ifPREDETERMINEDGOALSTATE
goalstatehn ;
switchmethod
case BreastFirstSearch:
case GreedySearch:
goal FirstGoalTestSearchTREEmethod &root, goalstate; break;
case DepthFirstSearch:
case DepthLimitedSearch:
goal DepthTypeSearchTREEmethod &root, goalstate, MaxLevel; break;
case IterativeDeepeningSearch:
forlevel; TRUE ;level
goal DepthTypeSearchTREEmethod &root, goalstate, level;
ifgoalFAILURE
printfThe goal is found in level d
level;
break;
break;
case UniformCostSearch:
case AStarSearch:
case GeneralizedAStarSearch:
goal FirstInsertFrontierSearchTREEmethod &root, goalstate, alpha; break;
default:
printfERROR: Unknown method.
;
exit;
ShowSolutionPathgoal;
return ;
change this code for puzzle game
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
