Just watch them, you can change the count by editing the "count" variable in the first tab
xxxxxxxxxx
float gravity = 1;
int count = 1500;
int Gen = 1;
int Round = 1;
int Best = 1;
ArrayList<Agent> agents;
ArrayList<Agent> genx;
ArrayList<Agent> place;
boolean wrap = false;
void setup(){
fullscreen();
frameRate(99999);
todo = new ArrayList();
todo.add("JUMP");
todo.add("NONE");
println(height);
agents = new ArrayList(count);
genx = new ArrayList(count);
place = new ArrayList(count);
for (int i = 0; i < count; i++) {
agents.add(new Agent(i));
}
genx = agents;
}
void draw(){
background(50);
textSize(50);
text("Generation " + Gen, 50, 50);
text("Alive: " + agents.size(), 700, 50);
text("Round " + Round, 50, 150);
text("Wall Size: " + round(obtH), 700, 150);
text("Best Round: " + Best, 50, 250);
if(place.size() > 1){
if(agents.size() < 3){
text("Best Agents: Agent " + place.get(0).id +" and Agent "+ place.get(1).id, 50, 350);
}
}
else{
text("Best Agents: " + "Waiting for Agents to finish", 50, 350);
}
if(finished == agents.size()){
reset();
finished = 0;
obtH += 5 + Round;
obtPos.y -= (5 + Round);
for (int i = 0; i < agents.size(); i ++) {
agents.get(i).fin = false;
}
}
if(agents.size() == 0){
Round = 0;
Gen += 1;
count += round(random(0, 2));
println(place);
if(place.size() < 2){
for (int i = 0; i < count; i++) {
agents.add(new Agent(i));
}
}
else{
for (int i = 0; i < count; i++) {
agents.add(new Agent(i));
agents.get(i).Splice(place.get(0), place.get(1));
}
for (int i = 0; i < agents.size(); i ++) {
agents.get(i).fin = false;
}
}
place.clear();
println(place);
println(agents.get(0).jh, agents.get(0).speed);
reset();
obtH = 200;
obtPos.y = height - obtH;
}
for (int i = 0; i < agents.size(); i ++) {
agents.get(i).move();
if(agents.get(i).pos.x + 20 > obtPos.x && agents.get(i).pos.x - 20 < obtPos.x + obtW && agents.get(i).pos.y + 15 > obtPos.y){
agents.remove(i);
}
}
Obt();
rect(0, height - 20, width, 20);
}