// checks if vertical cells around the current one are busy or not private bool cellsAroundVertFree(Board b, int xPos, int yPos, int dim) { bool busyFound = false; bool res = false; if (yPos + dim <= DIM) { for (int i = 1; i <= dim - 1; i++) { if (b.GetCell(xPos, yPos + i).IsBusy) { busyFound = true; break; } } if (!busyFound) res = true; } else { for (int i = 1; i <= dim - 1; i++) { if (b.GetCell(xPos, yPos - i).IsBusy) { busyFound = true; break; } } if (!busyFound) res = true; } return res; }