const gridsize  = 15; // min=5  max=25 step=1
const size   = 12; // min=5  max=50 step=1
const density  = 80; // min=0  max=100 step=1

const turtle = new Turtle();

// zeichnet L
function drawL(x, y) {
  const flip = Math.random() < 0.5; //zum spiegeln, random

  turtle.up();
  turtle.goto(x, y);
  turtle.down();

  if (flip) {
    turtle.goto(x + size, y);        // horizontaler Strich
    turtle.goto(x + size, y + size); // vertikaler Strich runter
  } else {
    turtle.goto(x, y + size);        // vertikaler Strich hoch
    turtle.goto(x + size, y + size); // horizontaler Strich
  }
}

// Raster füllen
for (let i = 0; i < gridsize; i++) {
  for (let j = 0; j < gridsize; j++) {
    const x = -100 + i * (200 / gridsize);
    const y = -100 + j * (200 / gridsize);

    // ob L gezeichnet wird oder nicht
    if (Math.random() * 100 < density) {
      drawL(x, y);
    }
  }
}