private int[,] RotatePattern(int[,] pattern, int angle) { (int width, int depth) = Grids.Dim(pattern); int[,] rotatedPattern = Grids.Blank(pattern); foreach ((int countW, int countD) in Itr.Iteration(width, depth)) { rotatedPattern[countD, width - countW - 1] = pattern[countW, countD]; } return(rotatedPattern); }