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