AI-Evolve-Befunge

 view release on metacpan or  search on metacpan

example.conf  view on Meta::CPAN

migrationd_port: 29522


# LOW LEVEL STUFF

# The number of dimensions newly created critters will operate in.  This
# setting only has an effect on the first generation (after that, it is
# inherited).
dimensions: 3

# The percentage of code (versus whitespace) from the random code generator.
code_density: 70

# Like code_density, above, but only applies to the first generation (or the
# first after resuming a saved results file).
initial_code_density: 90

# The number of resource tokens each critter gets, per battle.
tokens: 2000

# Number of tokens each character of code costs.

lib/AI/Evolve/Befunge/Population.pm  view on Meta::CPAN

    $self->blueprints([@{$self->blueprints}, @new])
        if scalar @new;
}


=head2 new_code_fragment

    my $trash = $population->new_code_fragment($length, $density);

Generate $length bytes of random Befunge code.  The $density parameter
controls the ratio of code to whitespace, and is given as a percentage.
Density=0 will return all spaces; density=100 will return no spaces.

=cut

sub new_code_fragment {
    my ($self, $length, $density) = @_;
    my @safe = ('0'..'9', 'a'..'h', 'j'..'n', 'p'..'z', '{', '}', '`', '_',
                '!', '|', '?', '<', '>', '^', '[', ']', ';', '@', '#', '+',
                '/', '*', '%', '-', ':', '$', '\\' ,'"' ,"'");



( run in 0.420 second using v1.01-cache-2.11-cpan-05162d3a2b1 )