This is for Kindergartners to learn about symmetry. They will do it on ipads with Processing.js. They tap on the left to get a random pattern of black squares and have to tap the corresponding mirrored squares on the right side. I used 2 two D arrays and 2-two d arrays of boolean variables to set them to white or black. If there is a better way to do this I welcome suggestions.:
Box[][] boxesLeft
Box[][] boxesRight;
int cols = 6;
int rows = 4;
float bias = 0.7;
boolean[][] isLeftWhite = new boolean[cols/2][rows];
boolean[][] isRightWhite = new boolean[cols/2][rows];
int[][] x = new int[cols/2][rows];
int[][] y = new int[cols/2][rows];
int cell = 100;
void setup() {
size(cols*cell,rows*cell);
stroke(0);
boxesLeft = new Box[cols/2][rows];
boxesRight = new Box[cols/2][rows];
for(int i=0;i<cols/2;i++) {
for(int j=0;j<rows;j++) {
x[i][j] = (i+cols/2)*width/cols;
y[i][j] = j*height/rows;
boxesLeft[i][j] = new Box(i*width/cols,j*height/rows,cell,cell);
boxesRight[i][j] = new Box(x[i][j],y[i][j],cell,cell);
I'm trying to delay my for loop in draw so the rectangles appear one at a time with 3 seconds delay rather than all appearing after an initial delay of 3 seconds. Can anyone see why the latter is happening and not the former? Delay() does not work and I've read much about how it is not appropriate for many contexts.
If anyone has a suggestion...I am stuck. The problem is with the 'twinkle' method at the end of code, but I'm posting all for context. I updated this old sketch that shows the Big Dipper twinkling with each star at a slightly different magnitude. As I've updated it to learn to write classes and arrays I'm finding I can't get the twinkle at different magnitude part to work. Each star grows and ebbs at the same rate and size. If you see down to line 69, the twinkle method in the Star class is where I'm passing array values for the maxSize of each. What I am finding is all stars will set their maxSize value by the highest value in the array no matter at what index that occurs, not their own maxSize value. Note all that text in the display method is just to see what values are being passed at each moment.