void TestRandomGeneratorWithString() { StringBuilder sb = new StringBuilder(); sb.Append("Begin random generator puzzle solver").AppendLine(); string state = PuzzleSolver.GenerateRandomSolvableState(); sb.Append("Solving " + PuzzleSolver.PrintableState(state)).AppendLine(); System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); List <string> path = PuzzleSolver.DepthFirstSearch(state); stopWatch.Stop(); sb.Append("Depth first search took " + stopWatch.ElapsedMilliseconds + " ms").AppendLine(); sb.Append("Depth first search path contains " + path.Count + " states").AppendLine(); stopWatch.Reset(); stopWatch.Start(); path = PuzzleSolver.BreadthFirstSearch(state); stopWatch.Stop(); sb.Append("Breadth first search took " + stopWatch.ElapsedMilliseconds + " ms").AppendLine(); sb.Append("Breadth first search path contains " + path.Count + " states").AppendLine(); sb.Append("Printing Solution"); foreach (string p in path) { sb.Append(PuzzleSolver.PrintableState(p)); } sb.Append("End puzzle solver").AppendLine(); debugClass.WriteStringToFile(RandomGeneratorFile, sb.ToString()); }