public string SolveProof(bool logical) { using (MemoryStream ms = new MemoryStream()) { StreamWriter log = new StreamWriter(ms); SolveResult solns; if (logical) { HintSelections hard = new HintSelections(HintSelections.Level.Extreme); solns = solver.DoLogicalProof(this, hard, log); } else { solns = solver.DoBacktrackingProof(this, log); } log.Flush(); ms.Position = 0; StringBuilder sb = new StringBuilder(); string line; using (StreamReader sr = new StreamReader(ms)) while ((line = sr.ReadLine()) != null) { sb.AppendLine(line); } sb.AppendLine(DescribeSolveResult(solns)); return(sb.ToString()); } }