String [] parents, children, configs; int [][] par=new int[5][5], chi=new int[8][5]; float [] C={-200, -100, 0, 100, 200}; float [] R={-200, -100, 0, 100, 200}; float [] c=new float[5], r=new float[5], bound=new float[2]; boolean[] H=new boolean[12], V=new boolean[12]; int cmax, pmax, j, k, state=0, ki=0, kf=100, T=50, t; float X, Y, bigX=500, bigY=250; boolean gridreset=false; void setup() { parents =loadStrings("parents.txt"); children =loadStrings("children.txt"); configs =loadStrings("configdata.txt"); size(750,650); noLoop(); } void draw() { cursor(CROSS); background(255,255,255); float x=mouseX, y=mouseY; if ((state==21)&(y>=bound[0])&(y<=bound[1])){R[1]=y-bigY;} if ((state==22)&(y>=bound[0])&(y<=bound[1])){R[2]=y-bigY;} if ((state==23)&(y>=bound[0])&(y<=bound[1])){R[3]=y-bigY;} if ((state==24)&(y>=bound[0])&(y<=bound[1])){R[4]=y-bigY;} if ((state==25)&(x>=bound[0])&(x<=bound[1])){C[1]=x-bigX;} if ((state==26)&(x>=bound[0])&(x<=bound[1])){C[2]=x-bigX;} if ((state==27)&(x>=bound[0])&(x<=bound[1])){C[3]=x-bigX;} if ((state==28)&(x>=bound[0])&(x<=bound[1])){C[4]=x-bigX;} if (state==30){ state=0; C[0]=-200;C[1]=-100;C[2]=0;C[3]=100;C[4]=200; R[0]=-200;R[1]=-100;R[2]=0;R[3]=100;R[4]=200;} for(k=0;k<5;k++){c[k]=0.1*C[k];r[k]=0.1*R[k];} if (gridreset){grid3();} // grid1(); grid2(); if (state!=1){t=0; transit();} // if (state==1&t=435)&(x<=555)&(y>=500)&(y<=550)){state=30;gridreset=false;redraw();} if ((state>20)&(state<29)){state=3;gridreset=true;} if ((state==0)&(y<250)&(x<250)){ if (1+int(floor(x/50))+5*int(floor(y/50))250 & x<250)){ if (1+5*int(floor((y-250)/50)) +int(floor(x/50))=sqrt(sq(bigX+C[4]+h-x)+sq(bigY+R[1]-y)))) {state=21;loop(); bound[0]=bigY+R[0]+3.5; bound[1]=bigY+R[2]-7;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[4]+h-x)+sq(bigY+R[2]-y)))) {state=22;loop(); bound[0]=bigY+R[1]+7; bound[1]=bigY+R[3]-7;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[4]+h-x)+sq(bigY+R[3]-y)))) {state=23;loop(); bound[0]=bigY+R[2]+7; bound[1]=bigY+R[4]-7;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[4]+h-x)+sq(bigY+R[4]-y)))) {state=24;loop(); bound[0]=bigY+R[3]+7; bound[1]=bigY+200;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[1]-x) +sq(bigY+R[4]+h-y)))){state=25;loop(); bound[0]=bigX+C[0]+3.5; bound[1]=bigX+C[2]-7;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[2]-x) +sq(bigY+R[4]+h-y)))){state=26;loop(); bound[0]=bigX+C[1]+7; bound[1]=bigX+C[3]-7;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[3]-x) +sq(bigY+R[4]+h-y)))){state=27;loop(); bound[0]=bigX+C[2]+7; bound[1]=bigX+C[4]-7;} if ((state==0)&(3.5>=sqrt(sq(bigX+C[4]-x) +sq(bigY+R[4]+h-y)))){state=28;loop(); bound[0]=bigX+C[3]+7; bound[1]=bigX+200;} }