#!/usr/bin/perl
# Michael Tartaglia
# evolution.cgi
# Example of a Drip-by-Drip generational algorithm, where the user
# enters a string, and the computer (starting from a random
# string of identical length) eventually arrives at the user's
# string.
use strict;
use CGI qw ( :standard );
require template;
template::startHTML("Freelance Program","Evolutionary Algorithms");
print "This is an example of a \"drop by drop\" evolutionary algorithm.
",
"\t
| Random start string: | ", cleanHTML($startCopy), " |
|---|---|
| ", cleanHTML($destination)," | |
| Mutation radius: | $radius |
| Mutation rate: | $rate |
| Generation size: | $size |
| Run size: | ", ($counter>=$MAX && $strongest ne $destination ? "$counter+" : $counter), " |
Based on the above information, ", "the computer took the following route to find your string. ", "Each line represents the closest match to your string, ", "found by mutating the previous line $size times ", "and taking the \"fittest\" of that bunch. ", " | |