Пример #1
0
 public void SolveSudokuDialog(object sender, RoutedEventArgs e)
 {
     try {
         sudo = sudo.Solve();
         string solvedString = Regex.Replace(sudo.ToString(), @"\t|\n|\r|\s", "");
         InitializeSudoku(CreateArrayFromString(solvedString));
     } catch {
         Stat.Text = "YOU NEED TO START A SUDOKU FIRST, MY N***A!";
     }
 }
Пример #2
0
        internal override string Execute(string[] args)
        {
            if (_gameContext.CurrentGame == null)
            {
                return(Resources.SolveCommand_Execute_NotLoadedGame);
            }

            var result = _sudoku.Solve(_gameContext.CurrentGame);

            if (!result.HasSolution)
            {
                return(Resources.SolveCommand_Execute_NoSolution);
            }
            if (!result.IsUnique)
            {
                return(Resources.SolveCommand_Execute_MoreThanOneSolution);
            }

            return(PrintHelper.PrintResult(result));
        }