static void BashThroughSudokus(string path, int number, int start = 0) { Shape shape = Shape.SquareGrid(3); string [] lines = File.ReadAllLines(path); ISolver solver = new RecursiveSolver(); SolverArgs args = new SolverArgs() { use_set_elimination = false }; Stopwatch stopwatch = Stopwatch.StartNew(); for (int i = start; i < number + start; i++) { int [] grid = lines [i].Select(x => int.Parse(x.ToString())).ToArray(); int [] [] solution = solver.Solve(shape, grid, args, out int diff, out int [] [] fill_orders); if (solution.Length != 1) { Console.WriteLine("!"); } if ((i + 1) % 100 == 0) { Console.Write("."); } if ((i + 1) % 500 == 0) { Console.Write(" "); } if ((i + 1) % 1000 == 0) { Console.Write("\n"); } if ((i + 1) % 5000 == 0) { Console.Write("\n"); } } double n = stopwatch.Elapsed.TotalSeconds / number; Console.WriteLine("\n" + n * 1000 + "ms per sudoku."); Console.WriteLine(1 / n + " sudoku per second."); }
void SolveAttempt(SolverArgs args) { if(args.IsSolved) { UpdateTotalSolved(1); } else { UpdateAttempts(1); } }