Skip to content

Instantly share code, notes, and snippets.

@jgrahamc
Created May 12, 2015 16:49
Show Gist options
  • Save jgrahamc/c4c84b3be086f024c9b5 to your computer and use it in GitHub Desktop.
Save jgrahamc/c4c84b3be086f024c9b5 to your computer and use it in GitHub Desktop.
Draws a picture with 9,999 red squares and one green one
int b = 100;
int s = 640;
int w = b*(s/b);
int h = w;
void setup() {
background(0);
size(w, h);
int side = w/b - 1;
int x;
int y;
noStroke();
int n = 0;
for (x = 1; x < w; x += side+1) {
for (y = 1; y < h; y += side+1) {
n += 1;
if (n == b*b/3) {
fill(0,255,0);
} else {
fill(255,0,0);
}
rect(x, y, side, side);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment