Skip to content

Instantly share code, notes, and snippets.

@Yuemashi
Created July 8, 2016 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yuemashi/fb112e75a3bdd8068da09896c47c18e8 to your computer and use it in GitHub Desktop.
Save Yuemashi/fb112e75a3bdd8068da09896c47c18e8 to your computer and use it in GitHub Desktop.
Genotype = -> size {(1..size).map{rand (0..1)}}
Population = -> individualSize, popSize {
(0..popSize).map{Genotype[individualSize]} }
fitness = -> genotype {genotype.inject(:+)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment