#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 ...

Get Ruby by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.