Hello @niuuin,
Some suggestions:
-
use if statements to determine a “choice” outside of the loop.
This is done once. -
use switch\case statements inside the loop.
Once choice is made for each step through the loop.
Example
int choice;
//if statements set choice
for (int r = 0; r < total; r++)
{
for (int c = 0; c < total; c++)
{
choice = 0;
switch(choice) {
case 0:
r1 = r;
c1 = c;
break;
case 1:
r1 = r;
c1 = total-c-1;
break;
case 2:
// ???
break;
case 3:
// ?;
break;
default:
r1 = r;
c1 = c;
break;
}
// code
}
References:
Look up the reference for clear():
https://processing.org/reference/clear_.html
That will make things clear!
Consider this at start of draw():
https://www.processing.org/reference/background_.html
:)