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(); }
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]); }