/*Update to version 2.0.1 -- Added AphidPop class to define parameters for entire population of aphids -- Added focus to ladybug. Ladybug now only eats the aphid that it has targetted, as opposed to all aphids in view -- Changed Lesson 3 to show effects of variation on evolution. -- Added Lessons 4 and 5 to show effects of heritability and selection on evolution */ int VARIATION_MASK = 0x00000001; int INHERITANCE_MASK = 0x00000002; int SELECTION_MASK = 0x00000004; color debugcolor; //07 Broad-Leaved Woodland_ Late Sprin.m4a ladybug ladyleft, ladyright, ladyall; int numAphids = 30; int maxAphids = 30; int numWeights = 10; // 3 inputs * 2 outputs int maxDrift = 10; boolean ladyleftAutonomous = true; AphidPop aphidsLeft = new AphidPop(maxAphids,1); AphidPop aphidsRight = new AphidPop(maxAphids,0); AphidPop aphidsAll = new AphidPop(maxAphids,2); bug[] aphidsleft = new bug[maxAphids]; bug[] aphidsright = new bug[maxAphids]; bug[] aphidsall = new bug[maxAphids]; PFont fontScore,fontWin,fontData; int score = 0; float aphidsPerSecond = 0; int flag = 1; int avgAge = 0; int maxAge = 0; int boardWidth = 500; int sideWidth = 500; int boardHeight = 500; int boarder = 5; int numLeaves = 2000; int numLeftRed,numLeftBlue,numLeftGreen; int numRightRed,numRightBlue,numRightGreen; int numAllRed,numAllBlue,numAllGreen; PGraphics leavesPGleft,leavesPGright,leavesPGall; PGraphics color_wheel; int ladybugBehavior = 1; color targetColor; //int aphidCaptureCount = 0; // counts aphids per 10 seconds //float aphidsPerMinute = 0; //float aphidPerMinuteStart = 0; // counts 10 seconds int buttonBox = 100; boolean PAUSE = false; boolean showLeft = true, showRight = true; PGraphics pg; boolean mutateAlpha = false; // flag to control whether alpha mutates boolean startWindow = true; int lessonNum = 0; int numLessons = 5; float hideChanceAvgLeft = 0; float hideChanceAvgRight = 0; int frameParamsRight = (0 | INHERITANCE_MASK | VARIATION_MASK | SELECTION_MASK); int frameParamsLeft = (0 | INHERITANCE_MASK | VARIATION_MASK | SELECTION_MASK); int H = 0; int S = 1; int V = 2; int R = 0; int G = 1; int B = 2; int wheel_radius = 40; color leavesLeft; color leavesRight; color leavesAll; void setup(){ pg = createGraphics(sideWidth,boardHeight/3,P2D); frameRate(30); noiseSeed(0); size(2*boardWidth+boarder*3,boardHeight+2*boarder+buttonBox); background(255,255,255); ladyleft = new ladybug(250,250,40,1); ladyright = new ladybug(750,250,40,0); ladyall = new ladybug(500,250,40,2); for(int i =0; i