AI::Evolve::Befunge::Blueprint - code storage object
my $blueprint = Blueprint->new(code => $codestring, dimensions => 4); my $name = $blueprint->name; my $string = $blueprint->as_string;
Blueprint is a container object for a befunge creature's code. It gives new blueprints a unique name, so that we can keep track of them and tell critters apart. One or more Critter objects may be created from the Befunge source code contained within this object, so that it may compete with other critters. As the critter(s) compete, the fitness score of this object is modified, for use as sort criteria later on.
my $blueprint = Blueprint->new(code => $codestring, dimensions => 4);
Create a new Blueprint object. Two attributes are mandatory:
code - a Befunge code string. This must be exactly the right length to fill a hypercube of the given dimensions. dimensions - The number of dimensions we will operate in.
Other arguments are optional, and will be determined automatically if not specified:
fitness - assign it a fitness score, default is 0. id - assign it an id, default is to call new_popid() (see below). host - the hostname, default is $ENV{HOST}.
my $blueprint = Blueprint->new_from_string($string);
Parses a text representation of a blueprint, returns a Blueprint object. The text representation was likely created by "as_string", below.
my $blueprint = Blueprint->new_from_file($file);
Reads a text representation (single line of text) of a blueprint from a results file (or a migration file), returns a Blueprint object. Calls "new_from_string" to do the dirty work.
print $blueprint->as_string();
Return a text representation of this blueprint. This is suitable for sticking into a results file, or migrating to another node. See "new_from_string" above.
These functions are exported by default.
my $id = new_popid();
Return a unique identifier.
set_popid($id);
Initialize the iterator to the given value. This is typically done when a new process reads a results file, to keep node identifiers unique across runs.
Mark Glines <mark-cpan@glines.org>
This software is copyright (c) 2008 Mark Glines.
It is distributed under the terms of the Artistic License 2.0. For details, see the "LICENSE" file packaged alongside this module.
To install AI::Evolve::Befunge, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::Evolve::Befunge
CPAN shell
perl -MCPAN -e shell install AI::Evolve::Befunge
For more information on module installation, please visit the detailed CPAN module installation guide.