### Cubic Disarray

Schotter by Georg Nees, also known as Cubic Disarray.
Based on the ALGOL version of the artwork

```// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

const PI2 = Math.PI * 0.5;
const PI4 = Math.PI * 0.25;
const SQRT2 = Math.sqrt(2)

const STARTX = -100
const STARTY = -100

var marginx = 0
var marginy = 0
var iter = 0;

const cols = 12  // min=8, max=100, step=1
const rows = 22  // min=8, max=100, step=1
const side = 6;  // min=2, max=20, step=1

var r = side * SQRT2;

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(-100,-100);

// The walk function will be called until it returns false.
function walk(i) {
marginx = (200 - cols*r)/2
if (marginx<0) marginx=0
for (row = 1; row <= rows; row++) {
for (col = 1; col <= cols; col++) {
}
}
return false
}

function drawQuad(p, q) {
step = iter / 264;
d = {min:-side * step, max: side * step};
a = { min: PI4 * (1 - step), max: PI4 * (1 + step) };
psi = map(Math.random(), 0,1, a.min, a.max)

x = STARTX + marginx + p*r + map(Math.random(),0,1,d.min, d.max)
y = STARTX + marginy + q*r + map(Math.random(),0,1,d.min, d.max)

for (s = 0; s <= 4; s++) {
if (s==0) turtle.penup()
else turtle.pendown()
psi += PI2;
turtle.goto(x+side * Math.cos(psi), y+side * Math.sin(psi));
}
turtle.penup()
iter += 1;
}

function map(number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}```