function setup() {
  createCanvas(windowWidth, windowHeight
  );
}

function draw() {
background(200);
  for (let x = 25; x < width; x = x + 50) {
    for (let y = 25; y < innerHeight; y = y + 50) {
      switch (key) {

        case "1":
          fill(random(255), 0, random(0, 255));
          rect(x, y, 70, 70);
          break;

        case "2":

         // for (let x = 25; y < width; x = x + 50) {
           // for (let y = 20; y < width; y = y + 50) {
              function2(x, y, 25);
           // }
        //  }
          break;
        case "3":
          function3(x, y, 100);
         
          break;
        case "4":
          ellipse1(x, y, 40);
          break;
      }

    }

  }
}

function function2(xVal, yVal, unit) {
  stroke(0);
  strokeWeight(1);

  line(xVal, yVal, xVal - unit, yVal + unit);
  line(xVal, yVal, xVal + unit, yVal + unit);
  line(xVal, yVal - unit, xVal - unit, yVal);
  line(xVal, yVal - unit, xVal + unit, yVal);
  line(xVal, yVal - unit, xVal, yVal + unit);
  line(xVal + unit, yVal - unit, xVal + unit, yVal + unit);
}

function function3(x, y, unit) {
  fill(random(255), 0, random(0, 255));
  rect(x, y, 100, 100);
}

function ellipse1(x, y, unit) {
  fill(random(255), random(0, 255), random(0, 255));
  noStroke();
  ellipse(x,y,80,80);
}


