// method to print the statistics void printStatistic() { int statisticHeight = 113; String textStr; PFont font; font = loadFont("FrutigerLinotype-Roman-12.vlw"); textFont(font, 12); int seconds = millis()/1000; int minutes = seconds/60; String time = seconds/60+" Minuten und "+seconds%60+" Sekunden."; int sum = population.size(); int longest = 0; int smallest; if(sum == 0) smallest = 0; else smallest = 10000; for(int i = 0; i < sum; i++) { worm tmp = (worm)population.get(i); if(tmp.wormLength > longest) longest = tmp.wormLength; if(tmp.wormLength < smallest && tmp.wormLength != 0) smallest = tmp.wormLength; } noStroke(); fill(color(255,150)); rect(10,img[activeImg].height-statisticHeight-10, img[activeImg].width-20,statisticHeight); fill(color(0,250)); textStr = "STATISTIK"; text(textStr, 15, img[activeImg].height-statisticHeight-5,480,50); fill(color(0,220)); if(sum == 1) textStr = sum+" Wurm besiedelt das Bild. \nEs wurden bereits "+pixelsEaten+" Pixel verschlungen. \nWurmlŠnge: "+longest+" Pixel \n\nZeit: "+time; else textStr = sum+" WŸrmer besiedeln das Bild. \nEs wurden bereits "+pixelsEaten+" Pixel verschlungen. \nKŸrzester Wurm: "+smallest+" Pixel \nLŠngster Wurm: "+longest+" Pixel \nZeit: "+time; text(textStr, 15, img[activeImg].height-statisticHeight+20,480,150); }