コード例 #1
0
 public void StartNewGame(Grid grid, Difficulty difficulty = Difficulty.Unknown)
 {
     ValidatorGrid.EnsureGridIsValid(grid);
     _grid         = grid.Clone();
     _solutionGrid = _solver.SolveGivens(_grid);
     Difficulty    = difficulty;
     GridChanged();
     _historyManager.ClearRedo();
     _historyManager.ClearUndo();
     SetModalState(ModalState.None);
     _colorManager.Clear();
     _gameTimerManager.StartTimer();
 }
コード例 #2
0
        public override Grid Solve(Grid input)
        {
            ValidatorGrid.EnsureGridIsValid(input);

            var hashcode = GetGivensHashcode(input);

            if (!_solved.ContainsKey(hashcode))
            {
                var grid = input.Clone();
                grid.FillAllLegalCandidates();
                _solved[hashcode] = SolveStep(grid);
            }

            return(_solved[hashcode]);
        }