using System.Collections.Generic;
public UninformedSearch()
public List<Node> BreadthFirstSearch(Node root)
List<Node> PathToSolution = new List<Node>();
List<Node> OpenList = new List<Node>();
List<Node> ClosedList = new List<Node>();
while(OpenList.Count > 0 && !goalFound)
Node currentNode = OpenList[0];
ClosedList.Add(currentNode);
currentNode.ExpandNode();
for(int = 0; i < currentNode.children.Count; i++)
Node currentChild = currentNode.children[i];
if (currentChild.GoalTest())
Console.WriteLine("Goal Found. ");
PathTrace(PathToSolution, currentChild);
if(!Contains(OpenList, currentChild) && !Contains(ClosedList, currentChild))
OpenList.Add(currentChild);
public void PathTrace(List<Node> path, Node n)
Console.WriteLine("Tracing path...");
while(current.parent != null)
current = current.parent;
public static bool Contains(List<Node> list, Node c)
for(int i = 0; i < list.Count; i++)
if (list[i].IsSamePuzzle(c.puzzle))