Hey I have to create an 8x8 checkerboard for a class assignment using processing. I have to use loops and conditionals as part of the assignment. I've figured out how to create vertical lines but I cant seem to create horizontal lines i've tried so hard but i cant seem to figure it out. Here's the code i have so far for my horizontal lines plz help.
void setup () {
size(200,200);
}
void draw () {
int numBars = 20;
float w = width / numBars;
// run 'numBars' times
for (int i=0; i < numBars; i++) {
rect(i*w, 0, w, height);
}
}
here's a link to the image i'm trying to achieve.
http://yooklid.files.wordpress.com/2010/01/checkerboard.jpg
void setup () {
size(200,200);
}
void draw () {
int numBars = 20;
float w = width / numBars;
// run 'numBars' times
for (int i=0; i < numBars; i++) {
rect(i*w, 0, w, height);
}
}
here's a link to the image i'm trying to achieve.
http://yooklid.files.wordpress.com/2010/01/checkerboard.jpg
1