I am working on a board game that requires me to color the bottom left corner of the board with random number of rows and columns a different color from the other blocks. Given an m x n grid, how do I calculate the index of the bottom left block? On a 4x4 block, the index is 12, on a 3x3 block the index 6, on a 2x2 block the index is 2, on a 3x4 block the index is 8, and on a 4x3 block the index is 9. Thank you in advance for the help!
I tried the following but it colors the top left box instead of the bottom left:
for(int r = 0; r < numRow; r++){
for(int c=0; c < numCol; c++){
if(r==numRow-1 && c==0){
buttons[c].setBackground(new Color(250, 0, 0));
buttons[c].setEnabled(false);
}
}
}