public static bool Compere(string newPlay, string file_stream, EventLog eventLog) { try { eventLog.WriteEntry("in BL:Compere "); Algoritem m = new Algoritem(); bool ret = m.MyComparer(file_stream, newPlay); eventLog.WriteEntry("ret: " + ret); return(ret); } catch (Exception) { return(false); throw; } }
/// <summary> /// Solves the specified name. /// </summary> /// <param name="name">The name.</param> /// <param name="algoritem">The algoritem.</param> /// <returns>Solution<Position>.</returns> public Solution <Position> Solve(string name, Algoritem algoritem) { //first of all - checcking if this maze exist if (!searchableMazes.ContainsKey(name)) { return(null); } //check if there is already a solution. if (solutions.ContainsKey(name)) { //check if the solution is from the right algoritem(BFS/DFS). if ((solutions[name]).ContainsKey(algoritem)) { return((solutions[name])[algoritem]); } } searchableMazes[name].Clean(); //and if not contain, we solve the maze Solution <Position> solution; if (algoritem == Algoritem.BFS) { solution = BFSSearcher.Search(searchableMazes[name]); solution.Name = searchableMazes[name].MyMaze.Name; } else { solution = DFSSearcher.Search(searchableMazes[name]); solution.Name = searchableMazes[name].MyMaze.Name; } //check if need to add a new dictionary(if there was no solution at all(DFS and BFS)). if (!solutions.ContainsKey(name)) { Dictionary <Algoritem, Solution <Position> > d = new Dictionary <Algoritem, Solution <Position> >(); solutions.Add(name, d); } //add the solution solutions[name].Add(algoritem, solution); //return the solution return(solution); }