public void Find(Solwrt solwrt) { SolutionFinder finder = new SolutionFinder(); IList solutions = finder.FindSolutions(new KnightSolutionEnumerator(hatesMap, needsMap, KnigtsNumber)); foreach (KnightSolution solution in solutions) { solwrt.Write(solution.ToString()); } }
public Solution[] FindSolutions(Solution previousSolution) { var solutionFinder = new SolutionFinder(this); var solutions = solutionFinder.FindSolutions(previousSolution); if (solutions == null) { return(new Solution[0]); } return(solutions.ToArray()); }
public void find_multiples_so_it_is_indeterminate() { fileSystem.CreateDirectory("multiples"); fileSystem.CleanDirectory("multiples"); fileSystem.WriteStringToFile("multiples".AppendPath("anything.sln"), "whatever"); fileSystem.WriteStringToFile("multiples".AppendPath("else.sln"), "whatever"); Environment.CurrentDirectory = Environment.CurrentDirectory.AppendPath("multiples").ToFullPath(); SolutionFinder.FindSolutionFile().ShouldBeNull(); // find the multiples too var solutions = SolutionFinder.FindSolutions(); solutions.ShouldHaveTheSameElementsAs( "anything.sln", "else.sln"); }