private void OcupyPosition(int row, int col) { AttackedCols.Add(col); AttackedLeftDiagonals.Add(col - row); AttackedRightDiagonals.Add(col + row); Positions[row, col] = true; }
private void FreePosition(int row, int col) { Positions[row, col] = false; AttackedCols.Remove(col); AttackedLeftDiagonals.Remove(col - row); AttackedRightDiagonals.Remove(col + row); }
private bool PositionIsFree(int row, int col) { if (AttackedCols.Contains(col)) { return(false); } if (AttackedLeftDiagonals.Contains(col - row) || AttackedRightDiagonals.Contains(col + row)) { return(false); } return(true); }