Saturday, 28 September 2013

3 colors loop in a grid

3 colors loop in a grid

I cannot post any picture because I just created this account but this is
the link to it:
https://www.cs.umd.edu/class/fall2013/cmsc131-12/Fall2013Proj2/InformationAndPictures.htm
if (countryCode == 2){
if (height % 3 == 0 && width % 3 == 0 ){
for (int col = 0; col < width; col = col + 1){
for (int row = 0; row < height; row = row + 1){
grid.setColor(row , col, Color.YELLOW);
}
}
for (int col = 0; col < width; col = col + 1){
for (int row = height / 3; row < height; row = row + 1){
grid.setColor(row, col, Color.GREEN);
}
}
for (int col = 0; col < width; col = col + 1){
for (int row = height / 2 + 1; row < height; row = row + 1){
grid.setColor(row , col, Color.RED);
}
}
}
}
So far this is what I have but I just can't get the red and green color to
balance correctly I know I something is wrong with my equation but I just
cannot figure it out.

No comments:

Post a Comment