Last active
March 17, 2016 16:21
-
-
Save exnihilodub/43aa47181bce67b6f0bb to your computer and use it in GitHub Desktop.
Assignment for Design by Code class. Switches position on mouse press.
This file contains hidden or 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[] boxes={0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0, | |
| 0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0, | |
| 0,0,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0, | |
| 0,1,1,1,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,0,1,1,1,0, | |
| 0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0, | |
| 0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,1,1,1,1,1,1,0,1,0, | |
| 0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0, | |
| 0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0, | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| }; | |
| */ | |
| int[] tempboxes1 = | |
| { 0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0, | |
| 0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0, | |
| 0,0,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,1,1,1,0,1,0, | |
| 0,1,1,1,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,0,1,1,1,0, | |
| 0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0, | |
| 0,1,0,1,1,1,1,1,1,0,1,0,0,0,0,1,1,1,1,1,1,0,0,0, | |
| 0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0, | |
| 0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0, | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| }; | |
| int[] tempboxes2 = | |
| { 0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0, | |
| 0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0, | |
| 0,1,0,1,1,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,1,0,0, | |
| 0,1,1,1,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,0,1,1,1,0, | |
| 0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0, | |
| 0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,0,1,0, | |
| 0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0, | |
| 0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0, | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |
| }; | |
| void setup() { | |
| size(1200, 400); | |
| } | |
| void draw() { | |
| background(255); | |
| fill(0); | |
| int[] boxes = tempboxes1; | |
| if (mousePressed) { | |
| boxes = tempboxes2; | |
| } | |
| for (int i = 0; i < boxes.length; ++i) { | |
| if (boxes[i]==1) { | |
| rect((i%24)*50, int(i/24)*50, 50, 50); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment