Example #1
0
 private void OcupyPosition(int row, int col)
 {
     AttackedCols.Add(col);
     AttackedLeftDiagonals.Add(col - row);
     AttackedRightDiagonals.Add(col + row);
     Positions[row, col] = true;
 }
Example #2
0
    private void FreePosition(int row, int col)
    {
        Positions[row, col] = false;

        AttackedCols.Remove(col);
        AttackedLeftDiagonals.Remove(col - row);
        AttackedRightDiagonals.Remove(col + row);
    }
Example #3
0
 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);
 }