Beispiel #1
0
        public Board Create(SudokuConfiguration configuration)
        {
            var board = CreateEmptyBoard(configuration);

            if (configuration.InitialValues != null)
            {
                ApplyInitialValues(configuration.InitialValues, board);
            }

            return(board);
        }
Beispiel #2
0
        public SudokuResult Solve(SudokuConfiguration configuration)
        {
            feedback.Information("Start solving ...");

            var stopWatch = new Stopwatch();

            stopWatch.Start();
            var board = boardFactory.Create(configuration);

            solveStrategy.Solver(board);
            stopWatch.Stop();

            feedback.Information($"Solved in {stopWatch.ElapsedMilliseconds}ms");

            return(new SudokuResult(stopWatch.Elapsed, board));
        }
Beispiel #3
0
 private static Board CreateEmptyBoard(SudokuConfiguration configuration)
 => new Board(
     configuration.NumberOfSections,
     configuration.SectionWidth,
     configuration.SectionHeight);