Hello,

So I’m a little confused on how to manage what I’m trying to fill, and how, inside nested loops.

I’m trying to have 3 rows of 20 circles each (to represent 60 seconds), where 1 circle is filled black every second. But I can only get as far as filling all 3 rows during the first 20 seconds and can’t figure out how to tell the program to fill 1 row, then continue filling on the next line.

P.S. I’m sorry for the messy code. I’m a coding fetus and I’ve just been trying a lot of random things trying to get it to work so there’s probably some stuff that doesn’t make much logical sense or dead code or something sorry…

```
int spacing = 20;
void setup() {
size(500, 500);
}
void draw() {
background(255); // white
int s = second();
int m = minute();
int h = hour();
// text
fill(0); // black
textSize(14);
text("Current Hour:", 20, 20);
text(h, 120, 20);
text("Current Minute:", 20, 130);
text(m, 140, 130);
text("Current Second:", 20, 300);
text(s, 140, 300);
// hour loop
for (int i = 0; i < 24; i++) {
ellipse((i*spacing) + 20, 50, 20, 20);
if (i + 1 < h) {
fill(0); //black
} else {
fill(255); // white
}
}
// minute loop
fill(0); // black
int x = 0;
int y = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 20; j++) {
ellipse(x + 20, y + 160, 24, 24);
x = x + 24;
if (i + 1 == m) {
fill(255); // white
}
}
y = y + 24;
x = 0;
if ( i < m);
fill(0);
}
// second loop
int z = 0;
int w = 0;
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 3; j++) {
ellipse(z + 20, w + 330, 24, 24);
w = w + 24;
if (i + 1 == s && j < 1) {
fill(255); // white
}
}
z = z + 24;
w = 0;
}
}
```

So basically my minutes and seconds counters are jacked up and i was wondering if anyone could help me out.