public string ToJsonDiff(CellState previous, int index) { if (Value > 0) { if(Value == previous.Value) return null; } else if(Possibilities.SetEquals(previous.Possibilities)) { return null; } return string.Format("[{0},{1}]", index, ToJson()); }
public SudokuCell(SudokuZone zone, int zoneRow, int zoneCol) { InitializeComponent(); this._zone = zone; this._zoneRow = zoneRow; this._zoneCol = zoneCol; this._value = null; this._cellState = SudokuCell.CellState.Editable; this._textChangedHandler = new TextChangedEventHandler(CellTextBox_TextChanged); this.DataContext = this; this.CellTextBox.MaxLength = (zone.Grid.Puzzle.Rank * zone.Grid.Puzzle.Rank).ToString().Length; this.BindTextBoxHandler(); }
public SudokuCell() { InitializeComponent(); this._zone = null; this._zoneRow = 0; this._zoneCol = 0; this._value = null; this._cellState = SudokuCell.CellState.Editable; this._textChangedHandler = new TextChangedEventHandler(CellTextBox_TextChanged); this.DataContext = this; this.CellTextBox.MaxLength = (3 * 3).ToString().Length; this.BindTextBoxHandler(); }
/// <summary> /// Replaces current values with those in an existing <see cref="CellState"/>. /// </summary> public void LoadState(CellState state) { Value = state.Value; Possibilities = new HashSet<int>(state.Possibilities); }