public IEnumerable<int> UsedNumbersInSpace(Location location) { int x = location.X; int y = location.Y; foreach (var item in GetCol(x, y)) { if (item.HasValue) { yield return item.Value; } } foreach (var item in GetRow(x, y)) { if (item.HasValue) { yield return item.Value; } } foreach (var item in GetSquare(x, y)) { if (item.HasValue) { yield return item.Value; } } }
public void Set(Location location, int value) { _board[location.X, location.Y] = value; for (int i = 0; i < _emptySpaces.Count; i++) { if (_emptySpaces[i].X == location.X && _emptySpaces[i].Y == location.Y) { _emptySpaces.RemoveAt(i); return; } } }