Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 /// <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);
 }