public void FillUndeterminedFieldsColumn(int columnIndex, BimaruValueConstraint constraint) { BimaruValue valueToSet = constraint.GetRepresentativeValue(); if (valueToSet == BimaruValue.UNDETERMINED || numberOfUndeterminedFieldsPerColumn[columnIndex] == 0) { return; } foreach (GridPoint p in PointsOfColumn(columnIndex).Where(p => GetFieldValueNoCheck(p) == BimaruValue.UNDETERMINED)) { this[p] = valueToSet; } }
public void FieldValueChanged(IGame game, FieldValueChangedEventArgs <BimaruValue> e) { BimaruValue newValue = game.Grid[e.Point]; foreach (Direction direction in Directions.GetAllDirections()) { BimaruValueConstraint constraintInDirection = newValue.GetConstraint(direction); GridPoint pointInDirection = e.Point.GetNextPoint(direction); BimaruValue valueInDirection = game.Grid[pointInDirection]; // Skip set if constraint already satisfied if (!constraintInDirection.IsSatisfiedBy(valueInDirection)) { BimaruValue valueToSet = constraintInDirection.GetRepresentativeValue(); game.Grid[pointInDirection] = valueToSet; } } }