static bool isInsideCube(int w, int h, int d, bool[, ,] cube) { return w >= 0 && w < cube.GetLength(0) && h >= 0 && h < cube.GetLength(1) && d >= 0 && d < cube.GetLength(2); } }