int init = 3000; int maxi = 8000; int totale = init; int stable = 0; int pass = 0; int x,y,ok,cycle,result,cliqued; cellule[] celluleListe; cellule[] tempListe; float prevT = millis(); PFont frameFont; void setup(){ size(230,230,P3D); framerate(8); frameFont = loadFont("ArialMT-14.vlw"); textFont(frameFont, 14); } void draw(){ if(focused){ if(stable == 0){ if(cliqued==1){ background(255); begginRandom(); } cliqued = 0; pass++; stable = 1; updateALL(); showInfos(); } if(mousePressed == true){ stable = 0; begginRandom(); } }else{ cliqued = 1; fill(255); stroke(0); rect(0,0,width-1,height-1); fill(50, 50, 50); text("Clic pour commencer ...", 20, 150); } } class cellule{ int Xpos, Ypos, lifeTime, Xmaj, Ymaj; color C,Cn; cellule(int a, int b, color c){ Xpos=a; Ypos=b; C = c; lifeTime = 0; if(C == color(255,0,0)){Cn = color (0,255,0);}else{Cn = color (255,0,0);} } void update(){ stroke(255); point(Xpos, Ypos); int bob = arounding(8,Cn); Xmaj = int(random(-bob,bob)); Ymaj = int(random(-bob,bob)); if(Xmaj + Ymaj > 0){stable = 0;} Xpos += Xmaj; Ypos += Ymaj; if(arounding(10,Cn) > 30 && totale < maxi){ addCellule(Xpos + int(random(-2,2)),Ypos + int(random(-2,2)),C); stable = 0; } } void show(){ stroke(C); point(Xpos, Ypos); } int arounding(int zone, color type){ int around = 0; for(int x=-zone; x