Algorithm-Metric-Chessboard
view release on metacpan or search on metacpan
lib/Algorithm/Metric/Chessboard.pm view on Meta::CPAN
wormhole_cost => 3,
);
C<wormholes> is optional. C<wormhole_cost> defaults to 0.
=cut
sub new {
my ($class, %args) = @_;
my $self = {};
bless $self, $class;
$self->x_range( $args{x_range} ) or croak "Bad 'x_range'";
$self->y_range( $args{y_range} ) or croak "Bad 'y_range'";
$self->wormholes( $args{wormholes} );
$self->wormhole_cost( $args{wormhole_cost} );
$self->calculate_wormhole_dists;
return $self;
}
=item B<nearest_wormhole>
lib/Algorithm/Metric/Chessboard/Journey.pm view on Meta::CPAN
);
This is purely a data object. You don't want to call this directly;
it's used internally by L<Algorithm::Metric::Chessboard>.
=cut
sub new {
my ($class, %args) = @_;
my $self = {};
bless $self, $class;
$self->start( $args{start} );
$self->end( $args{end} );
$self->via( $args{via} );
$self->distance( $args{distance} );
return $self;
}
sub start {
my ($self, $value) = @_;
$self->{start} = $value if $value;
lib/Algorithm/Metric/Chessboard/Wormhole.pm view on Meta::CPAN
C<x> and C<y> are mandatory. C<id> is optional; it's not used
internally but is provided as a space for you to store any id you
like, in case your program is interested in which wormholes were used
in a journey.
=cut
sub new {
my ($class, %args) = @_;
my $self = {};
bless $self, $class;
$self->x( $args{x} );
$self->y( $args{y} );
$self->id( $args{id} );
return $self;
}
sub x {
my ($self, $value) = @_;
$self->{x} = $value if $value;
return $self->{x};
( run in 0.795 second using v1.01-cache-2.11-cpan-de7293f3b23 )