예제 #1
0
        //public bool HasError()
        //{
        //    return (GetPossibleValuesCount() == 0);
        //}

        public object Clone()
        {
            var possibilities = new bool[_maxPossibilities];

            _possibilities.CopyTo(possibilities, 0);
            var field = new SudokuField(possibilities);

            return(field);
        }
예제 #2
0
        public virtual object Clone()
        {
            // clone all fields and apply them to a new sudoku
            var fields = new SudokuField[_length, _length];

            GetFields1D().ToList().ForEach(x => fields[x.RowIndex, x.ColumnIndex] = (SudokuField)x.Clone());
            var ret = new SudokuPuzzle(fields);

            return(ret);
        }
예제 #3
0
        public FieldCollection1D(int length)
        {
            // runs in constant time
            _length = length;
            _fields = new SudokuField[_length];

            for (int i = 0; i < _length; i++)
            {
                _fields[i] = new SudokuField();
            }
        }
예제 #4
0
        public SudokuField[] GetFields1D()
        {
            var fields = new SudokuField[_length * _length];

            for (int row = 0; row < _length; row++)
            {
                for (int column = 0; column < _length; column++)
                {
                    fields[row * _length + column] = _fields[row, column];
                }
            }

            return(fields);
        }
예제 #5
0
        public FieldCollection2D(int length)
        {
            _length = length;
            _fields = new SudokuField[_length, _length];

            for (int row = 0; row < _length; row++)
            {
                for (int column = 0; column < _length; column++)
                {
                    _fields[row, column] = new SudokuField();
                }
            }

            init();
        }