{{{ //declaración de banderas //luego debe trabajarse con un vector int x=0; int x2=0; int x3=0; int x4=0; int x5=0; int x6=0; int x7=0; int x8=0; int x9=0; void setup() { size(260,260); stroke(0); background(25,400,43); } void draw() { // cuadricula con rectángulos sin bordes // cada cuadro de 80x80 // con espesor 10 rect(80,0,10,300); rect(170,0,10,300); rect(0,80,400,10); rect(0,170,400,10); } void mousePressed() { background(25,400,43); //para dibujar en el primer cuadrante if ((mouseX < 80) && (mouseX > 0) && (mouseY > 0) && (mouseY < 80)) x=x+1; //para dibujar en el segundo cuadrante if ((mouseX < 170) && (mouseX > 90) && (mouseY > 0) && (mouseY < 80)) x2=x2+1; //para dibujar en el tercer cuadrante if ((mouseX < 240) && (mouseX >180) && (mouseY > 0) && (mouseY < 80)) x3=x3+1; //para dibujar en el 4to cuadrante if ((mouseX < 80) && (mouseX >0) && (mouseY >90) && (mouseY < 170)) x4=x4+1; //para dibujar en el 5to cuadrante if ((mouseX < 170) && (mouseX >90) && (mouseY > 90) && (mouseY < 170)) x5=x5+1; //para dibujar en el 6to cuadrante if ((mouseX < 240) && (mouseX >170) && (mouseY > 90) && (mouseY < 170)) x6=x6+1; //para dibujar en el 7to cuadrante if ((mouseX < 80) && (mouseX >0) && (mouseY >170) && (mouseY < 240)) x7=x7+1; //para dibujar en el 8to cuadrante if ((mouseX < 170) && (mouseX >90) && (mouseY >170) && (mouseY < 240)) x8=x8+1; //para dibujar en el 9to cuadrante if ((mouseX < 240) && (mouseX >170) && (mouseY >170) && (mouseY < 240)) x9=x9+1; if (x == 1){ line(0,0,80,80); line(0,80,80,0); } if (x == 2) ellipse(40, 40, 55, 55); if (x == 3) x= 0; if (x2 == 1){ line(90,0,170,80); line(90,80,170,0); } if (x2 == 2) ellipse(128, 40, 55, 55); if (x2 == 3) x2=0; if (x3 == 1){ line(180,0,260,80); line(180,80,260,0); } if(x3==2) ellipse(216, 40,55,55); if(x3==3) x3=0; if (x4 == 1){ line(0,90,80,170); line(0,170,80,90); } if(x4==2) ellipse(40,130,55,55); if(x4==3) x4=0; if (x5 == 1){ line(90,90,170,170); line(90,170,170,90); } if(x5==2) ellipse(132, 130,55,55); if(x5==3) x5=0; if (x6 == 1){ line(180,90,270,180); line(260,90,180,170); } if(x6==2) ellipse(220, 130,55,55); if(x6==3) x6=0; if (x7 == 1){ line(0,260,90,170); line(0,180,90,270); } if(x7==2) ellipse(40,220,55,55); if(x7==3) x7=0; if (x8 == 1){ line(80,170,180,270); line(170,180,90,260); } if(x8==2) ellipse(128, 220,55,55); if(x8==3) x8=0; if (x9 == 1){ line(170,170,260,260); line(180,260,260,180); } if(x9==2) ellipse(220, 220,55,55); if(x9==3) x9=0; } //cierre del Mousepressed }}}