The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

    AI::Evolve::Befunge::Blueprint - code storage object

SYNOPSIS

    my $blueprint = Blueprint->new(code => $codestring, dimensions => 4);
    my $name   = $blueprint->name;
    my $string = $blueprint->as_string;

DESCRIPTION

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.

METHODS

new

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

new_from_string

    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.

new_from_file

    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.

as_string

    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.

STANDALONE FUNCTIONS

These functions are exported by default.

new_popid

    my $id = new_popid();

Return a unique identifier.

set_popid

    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.

AUTHOR

    Mark Glines <mark-cpan@glines.org>

COPYRIGHT AND LICENSE

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.