I don’t understand the //shuffle cards thing.
//assigning values to each card in the grid
int[] values = new int[20];
for (int i=0; i<icons.length; i++) {
icons[i] = loadImage(filename[i]);
values[2*i] = i;
values[2*i+1] = i;
}
//shuffle cards
for (int i=0; i<values.length; i++) {
int r = int(random(values.length));
int t = values[i];
values[i] = values[r];
values[r] = t;
}