//Boredom bots float E = 2.71828182845904523536; bot [] yay = new bot[150]; void setup(){ size(500,300); for (int i = 0; i < 150; i++){ yay[i] = new bot (i * 10, i * 10, (i>>1)+1, int(random(5)), i * 3); } smooth(); framerate(30); } void loop(){ background(0); for (int i = 0; i < 150; i++){ move(i); } if (mousePressed) { restart(); } } void move(int t){ yay[t].move(); stroke(100); fill(50); ellipse(yay[t].x - 5, yay[t].y - 5, 10, 10); stroke(255); point(yay[t].x, yay[t].y); } void restart(){ for (int i = 0; i < 150; i++){ for (int ii = 0; ii < 5; ii++){ yay[i].speed[ii].i = 0; yay[i].speed[ii].phase = 1; } } } class bot{ float x, y; int dec, dir, fli, f; boredom [] speed = new boredom[5]; bot (float xt, float yt, int dect, int dirt, int flit){ f=0; x = xt; y= yt; dec = dect; dir = dirt; fli = flit; for (int i = 0; i<5; i++){ speed[i] = new boredom (dec, 8); } }//constructor; void move(){ float theta = (TWO_PI / 5) * dir; //get fwrap function from para bot x = fwrap (x+(cos(theta) * speed[dir].xlvl), width); y = fwrap (y+(sin(theta) * speed[dir].xlvl), height); speed[dir].plus(); if (f < fli){ f++; }else{ f = 0; dir = int (random(5)); } }//move; }//class; class boredom { float xlvl; int i; int irata; float xmax; int phase; boredom (int iratat, float xmaxt){ i = 0; phase = 1; irata = iratat; xmax = xmaxt; }//constructor; void plus(){ float x = (6.0 / irata) * i; xlvl = (xmax / nDist(0,1,0)) * nDist(x,phase,3); //i = (i + 1)%irata; if (i < irata){ i++; }else{ i = 0; phase++; } }//plus; }//class; float nDist (float xx, float sigma, float mu){ return pow(E,-(sq((xx-mu))) / (2 * sq(sigma))) / (sigma*sqrt(TWO_PI)); }//where sigma is the scale of the graph & mu shifts the location of the graph along x float fwrap (float fvalu, float flimi){ float fcar=fvalu; if (fcar>flimi){ fcar=(fcar)%flimi; } if (fcar<0){ fcar=flimi-fcar; fcar=(fcar)%flimi; fcar=flimi-fcar; } return fcar; }//fwrap;