/// <summary> /// Função principal de busca /// </summary> /// <returns></returns> private int[] FindSolution() { Node inicio = new Node(null, initState, 0, null); PQ open = new PQ(); List <Caminho> closed = new List <Caminho>(); int euristicaInicio = Euristica(inicio); Caminho n = new Caminho(inicio, euristicaInicio, 0); open.Add(n); closed.Add(n); while (!open.EstaVazio()) { foreach (Caminho m in GetSucessors(n.N, euristicaInicio)) { if (!closed.Contains(m)) { open.Add(m); } } n = open.Pop(); closed.Add(n); if (TargetFound(n.N)) { break; } } return(BuildAnswer(n.N));; }