Created
May 12, 2015 16:49
-
-
Save jgrahamc/c4c84b3be086f024c9b5 to your computer and use it in GitHub Desktop.
Draws a picture with 9,999 red squares and one green one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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