SolidColorBrush White = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
SolidColorBrush[,] UPPSide = new SolidColorBrush[3, 3];
for(int i = 0; i < 3; i )
{
for(int j = 0; i <3; j )
{
UPPSide[i, j] = White;
}
}
List<SolidColorBrush[,]> theCube = new List<SolidColorBrush[,]> { UPPSide, FRTSide, DWNSide, BCKSide, LFTSide, RGTSide };
This is one of the sides of the Rubik's cube, i declared "white" as the color and made a 2d array [3*3] to assign the colors in so i could rotate it, but there was an out of bound exception, I don't realise what the problem is though. Please let me know if i phrased anything unclear, not a good question maker. edited enter image description here
i think thats the program running and stopped
CodePudding user response:
The reason for the "out of bounds" exception is because you have a typo on your inner for
loop. You wrote i <3
instead of j <3
.
Change it to this:
for(int i = 0; i < 3; i )
{
for(int j = 0; j <3; j )
{
UPPSide[i, j] = White;
}
}