public static void addPredators(World w) { //I cheat and store a copy of the ANN in everything so I don't have to make special cases for //heterogeneous and homogeneous Worlds w.addPlayer(new Predator(300, 500, w.agentSize, w.agentSize, w.bigBrain)); w.addPlayer(new Predator(400, 500, w.agentSize, w.agentSize, w.bigBrain)); w.addPlayer(new Predator(500, 500, w.agentSize, w.agentSize, w.bigBrain)); w.addPlayer(new Predator(600, 500, w.agentSize, w.agentSize, w.bigBrain)); w.addPlayer(new Predator(700, 500, w.agentSize, w.agentSize, w.bigBrain)); }
public static World diamondWorldVar(INetwork network, float spacing) { float middleX = 500; float middleY = 200; World w = new World(network); addPredators(w); w.addEnemy(new Prey(middleX , middleY + 2f*spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + spacing, middleY + spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - spacing, middleY + spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - 2f * spacing, middleY, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + 2f * spacing, middleY, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX, middleY - 2f*spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - spacing, middleY - spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + spacing, middleY - spacing, w.agentSize, w.agentSize)); return w; }
public static World lWorldVar(INetwork network, float spacing) { float middleX = 500; float middleY = 250; World w = new World(network); addPredators(w); w.addEnemy(new Prey(middleX - 1.5f * spacing, middleY + 1.5f * spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - 1.5f * spacing, middleY + .5f * spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - 1.5f * spacing, middleY - .5f * spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - 1.5f * spacing, middleY - 1.5f * spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - .5f * spacing, middleY - 1.5f * spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + .5f * spacing, middleY - 1.5f * spacing, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + 1.5f * spacing, middleY - 1.5f * spacing, w.agentSize, w.agentSize)); return w; }
public static World world5(INetwork network) { World w = new World(network); w.addPlayer(new Predator(500, 500, 5, 5, network)); w.addEnemy(new Prey(650, 450, w.agentSize, w.agentSize)); return w; }
public static World world2(INetwork network) { World w = new World(network); w.addPlayer(new Predator(500, 500, 10, 10, network)); w.addEnemy(new Prey(425, 400, w.agentSize, w.agentSize)); return w; }
public static World pointWorldVar(INetwork network, float angle) { float middleX = 500; float bottomY = 400; float spacing = 150; World w = new World(network); addPredators(w); w.addEnemy(new Prey(middleX, bottomY, w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + spacing * (float)Math.Cos(angle), bottomY - spacing * (float)Math.Sin(angle), w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - spacing * (float)Math.Cos(angle), bottomY - spacing * (float)Math.Sin(angle), w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX + 2 * spacing * (float)Math.Cos(angle), bottomY - 2*spacing * (float)Math.Sin(angle), w.agentSize, w.agentSize)); w.addEnemy(new Prey(middleX - 2 * spacing * (float)Math.Cos(angle), bottomY - 2 * spacing * (float)Math.Sin(angle), w.agentSize, w.agentSize)); return w; }
private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 'm') drawPie = !drawPie; else if (e.KeyChar == '/') { if (!isMulti) w.go(100); else w.goMulti(100); timer += 100; } else if (e.KeyChar == '1') { w = SkirmishNetworkEvaluator.world1(network); timer = 0; } else if (e.KeyChar == '2') { w = SkirmishNetworkEvaluator.world2(network); timer = 0; } else if (e.KeyChar == '3') { w = SkirmishNetworkEvaluator.world3(network); timer = 0; } else if (e.KeyChar == '4') { w = SkirmishNetworkEvaluator.world4(network); timer = 0; } else if (e.KeyChar == '5') { w = SkirmishNetworkEvaluator.world5(network); timer = 0; } else if (e.KeyChar == 'q') { w = SkirmishNetworkEvaluator.pointWorldVar(network, 3*(float)Math.PI / 8.0f); timer = 0; } else if (e.KeyChar == 'w') { w = SkirmishNetworkEvaluator.pointWorldVar(network, (float)Math.PI/4.0f); timer = 0; } else if (e.KeyChar == 'e') { w = SkirmishNetworkEvaluator.pointWorldVar(network, (float)Math.PI / 8.0f); timer = 0; } else if (e.KeyChar == 'a') { w = SkirmishNetworkEvaluator.diamondWorldVar(network, 75); timer = 0; } else if (e.KeyChar == 's') { w = SkirmishNetworkEvaluator.diamondWorldVar(network, 100); timer = 0; } else if (e.KeyChar == 'd') { w = SkirmishNetworkEvaluator.diamondWorldVar(network, 125); timer = 0; } else if (e.KeyChar == 'z') { w = SkirmishNetworkEvaluator.squareWorldVar(network, 75); timer = 0; } else if (e.KeyChar == 'x') { w = SkirmishNetworkEvaluator.squareWorldVar(network, 100); timer = 0; } else if (e.KeyChar == 'c') { w = SkirmishNetworkEvaluator.squareWorldVar(network, 125); timer = 0; } else if (e.KeyChar == 'r') { w = SkirmishNetworkEvaluator.lWorldVar(network, 75); timer = 0; } else if (e.KeyChar == 't') { w = SkirmishNetworkEvaluator.lWorldVar(network, 100); timer = 0; } else if (e.KeyChar == 'y') { w = SkirmishNetworkEvaluator.lWorldVar(network, 125); timer = 0; } else { if (!isMulti) w.timeStep(); else w.timeStepMulti(); timer++; } Invalidate(); }