# Creates a selector using tournament selection
def EvolutionaryAlgorithm.make_tournament_selector(tournamentSize, getFitness)
return Proc.new { |pop, count|
newPop = []

while newPop.length < count do
pool = pop.random_elements(tournamentSize)
fitnesses = pool.collect { |i| getFitness.call(i) }
newPop.push(pool[fitnesses.max_index()])
end

newPop
}
end