function Population(size) {
	var agents = new Array(size);
	var genomes = new Array(size);
	for (i = 0; i < size; i++) {
		var prob = Math.random();
		if (prob <= 0.33) {
			genomes[i] = new Genome(1,0,0);
		}
		elseif (prob > 0.33 && prob <= 0.67) {
			genomes[i] = new Genome(0,1,0);
		}
		else genomes[i] = new Genome(0,0,1);
		agents[i] = new Agent(genomes[i]);
	}
	this.pop = agents;
}

// "T" for tournament, "R" for roulette wheel
var parentmethod = "T";

Population.prototype.parentselection = function() {
	// Get all fitness functions from parents
	if (parentmethod == "T") {

		// Choose parents


		// return parents
	}
	else if (parentmethod == "R") {
		
	}
}

@@ -154,17 +154,16 @@
  (prob %3C
-=
  0.33) %7B
@@ -208,16 +208,17 @@
 %7D%0A%09%09else
+ 
 if (prob
@@ -219,16 +219,17 @@
  (prob %3E
+=
  0.33 &&
@@ -235,17 +235,16 @@
 & prob %3C
-=
  0.67) %7B
@@ -551,16 +551,169 @@
 parents%0A
+%09var fitness = new Array(this.pop.length);%0A%09for (i = 0; i %3C this.pop.length; i++) %7B%0A%09%09fitness%5Bi%5D = this.pop%5Bi%5D.getFitness();%0A%09%7D%0A%09// Tournament selection%0A
 %09if (par
@@ -732,17 +732,16 @@
  %22T%22) %7B%0A
-%0A
 %09%09// Cho
@@ -748,40 +748,286 @@
 ose 
-parents%0A%0A%0A%09%09// return parents%0A%09%7D
+k individuals from population at random%0A%09%09for (p = 0; p %3C 4; p++) %7B%0A%09%09%09var k = 3;%0A%09%09%09var parents = new Array(k);%0A%09%09%09for (i = 0; i %3C tournament; i ++) %7B%0A%09%09%09%09parents%5Bi%5D = Math.round(Math.random() * this.pop.length);%0A%09%09%09%7D%0A%09%09%0A%09%09%7D%0A%09%09// return parents%0A%09%7D%0A%0A%09// Roulette wheel selection
 %0A%09el
@@ -1060,12 +1060,58 @@
 ) %7B%0A
-%09%09
 %0A%09%7D%0A%7D%0A
+%0A%0APopulation.prototype.update = function() %7B%0A%0A%7D%0A

Edit parent selection, update gamemanager to Senna's version