O'Reilly logo

Ruby by Example by Kevin C. Baird

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

#36 Mutating the Mutation of Strings into Weasels (methinks_meta.rb)

This script uses the previous one, methinks.rb, so make sure you understand how that one works before trying this one, methinks_meta.rb. This script uses techniques similar to those used in methinks.rb to find the “best” input parameters for methinks.rb.

The previous script’s performance (the number of generations it takes to match the target) can vary greatly from one run to the next. Two major factors affect that variation in our results: The first factor is the set of arbitrary starting parameters. We saw that a target of hello was much easier to reach quickly than a target of methinksitislikeaweasel. Using other values for :mutation_rate or the other parameters also has an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required