v Depth Limited Search
public static void Depth_Limited_Search(Node Start, Node Goal, int depth_Limite)
{ GetSucc x = new GetSucc(); ArrayList children = new ArrayList(); Stack Fringe = new Stack(); Fringe.Push(Start); while (Fringe.Count != 0) { Node Parent = (Node)Fringe.Pop(); Console.WriteLine("Node {0} Visited ", Parent.State); // Console.ReadKey(); if (Parent.State == Goal.State) { Console.WriteLine(); Console.WriteLine("Find Goal " + Parent.State); break; }//end if if (Parent.depth == depth_Limite) { continue; } else { children = x.GetSussessor(Parent.State); for (int i = 0; i < children.Count; i++) { int State = (int)children[i]; Node Tem = new Node(State, Parent); Fringe.Push(Tem); }//end for }//end else }//end while }//end method
No comments:
Post a Comment