Created
July 5, 2012 19:12
-
-
Save Poincare/3055769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chromosome | |
... | |
def self.set_roulette(chrs) | |
@@roulette = [] | |
chrs.each do |f| | |
i = 0 | |
while i < f.fitness | |
@@roulette.push(f) | |
i += 1 | |
end | |
end | |
end | |
def self.roulette(chrs) | |
return @@roulette[rand(@@roulette.length)] | |
end | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment