dino_game_v2.rb
# Get the fitness of dinosaur population

Get the fitness of dinosaur population
Get the fitness of dinosaur population
def fitness(scores)
	num_dinos = scores.length
	scores = scores.sort_by { |dino, score| score }
	return scores[num_dinos - 1][0].to_i, scores[num_dinos - 2][0].to_i, scores[0][0].to_i, scores[1][0].to_i
end
def fitness ( scores ) num_dinos = scores . length scores = scores . sort_by { | dino , score | score } return scores [ num_dinos - 1 ] [ 0 ] . to_i , scores [ num_dinos - 2 ] [ 0 ] . to_i , scores [ 0 ] [ 0 ] . to_i , scores [ 1 ] [ 0 ] . to_i end
Get the fitness of dinosaur population
Get the fitness of dinosaur population
scores
<not_specific>