letn_same,n,c1,c2,pStr,nStr,sp;letplayBool=true;functionsetup(){w=max(350,min(windowWidth,windowHeight))*0.9;n=0;n_same=0;cnv=createCanvas(w,w);background(200);describe("A square cut into 4 equal squares where the top left and bottom right are cut along the diagonal and shaded darker than the rest of the squares and pieces. The canvas starts bland and the squares are drawn with static-like dots.");noStroke();}functiondraw(){noStroke();fill(200);rect(0,0,w,w*0.05);rect(0,w*0.95,w,w*0.05);fill(0);stroke(0);if(!mouseIsPressed){text("P: "+str(round(n_same/n,8)),w-115,15);text("n: "+str(n),10,15);}if(playBool){for(leti=0;i<5000;i++){draw_two();}}}functiondraw_two(){t=frameCount/100;c1=color(2+100*Math.sin(t),155+100*Math.sin(t/4),166+100*Math.sin(t/3),20);c2=color(0+100*Math.sin(t/5),43+100*Math.sin(t/3),46+100*Math.sin(t/6),20);n1=Math.random();n2=Math.random();n++;sum_add_first=round(n1+n2);sum_add_last=round(n1)+round(n2);if(sum_add_first===sum_add_last){n_same++;stroke(c1);s=1;}else{stroke(c2);s=1;}point(w*0.05+w*n1*0.9,w*0.05+w*n2*0.9,s);}functionwindowResized(){setup();draw();}functionkeyPressed(){playBool=!playBool;if(keyCode===83){save(cnv,"prob","png");}}