Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
#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
#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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started