Example #1
0
        private void FillCellAndSetDirty(int row, int column, Color?colorToFill = null)
        {
            colorToFill = colorToFill ?? _currentColor.MyColor;
            if (WorkingGrid[row, column].Equals(Color.Empty))
            {
                WorkingGrid[row, column] = colorToFill.Value;
                _paintedCount++;
                _isDirty = true;
            }
#if DEBUG
            _readableString = WorkingGrid.ToReadableString();
            if (AnswerGrid != null && AnswerGrid[row, column] != colorToFill.Value)
            {
                throw new Exception(string.Format("Oops, wrong color! Expected: <{0}>. Actual: <{1}>", AnswerGrid[row, column], colorToFill.Value));
            }
#endif
        }
Example #2
0
        private void SolveActually()
        {
#if DEBUG
            _readableString = WorkingGrid.ToReadableString();
#endif
            do
            {
                _iterationCounter++;
                _isDirty = false;
                Iterate(Selection.Row);
                Iterate(Selection.Column);
                IterateCells();
                if (CellCount == _paintedCount)
                {
                    break;
                }
            } while (_isDirty);
        }