Example #1
0
 public ActionResult <int[, ]> Post([FromBody] int[,] input)
 {
     try
     {
         _sudokuSolver.SolveSudoku(input, 0, 0);
         return(input);
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex.Message));
     }
 }
Example #2
0
        private async void Solve(object sender, EventArgs e)
        {
            int[,] values = puzzleView.cellValues;

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            await Task.Run(() => sudokuSolver.SolveSudoku(values));

            stopWatch.Stop();
            puzzleView.processTime = stopWatch.ElapsedMilliseconds.ToString() + " ms";

            for (int r = 0; r < 9; r++)
            {
                for (int c = 0; c < 9; c++)
                {
                    Tuple <int, int> key = new Tuple <int, int>(r, c);
                    puzzleView.board[key].Text = values[r, c].ToString();
                }
            }
        }