private bool CheckIfNextCellIsEmpty(int row, int col, int[] directionRow, int[] directionCol) { for (int dirIndex = 0; dirIndex < DirectionsCount; dirIndex++) { int nextRow = row + directionRow[dirIndex]; int nextCol = col + directionCol[dirIndex]; if (this.matrix[nextRow, nextCol] == 0) { return true; } } return false; }