Games-Board
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Games/Board.pm view on Meta::CPAN
#pod
#pod =cut
sub new {
my $class = shift;
my $board = {
spaces => { }
};
bless $board => $class;
}
#pod =method space
#pod
#pod my $space = $board->space($id);
#pod
#pod This method returns the space with the given C<$id>. If no space with that id
#pod exists, undef is returned.
#pod
#pod =cut
lib/Games/Board/Grid.pm view on Meta::CPAN
#pod =cut
sub new {
my ($class, %args) = @_;
croak "no size given to construct grid" unless $args{size};
$args{size} = [ ($args{size}) x 2 ] unless ref $args{size};
my $board = { size => $args{size} };
bless $board => $class;
$board->init;
}
#pod =method init
#pod
#pod This method sets up the spaces on the board.
#pod
#pod =cut
sub init {
lib/Games/Board/Piece.pm view on Meta::CPAN
#pod =cut
sub new {
my ($class, %args) = @_;
return unless $args{id};
return unless eval { $args{board}->isa('Games::Board') };
my $piece = { %args };
bless $piece => $class;
}
#pod =method id
#pod
#pod This returns the piece's id.
#pod
#pod =cut
sub id {
my $self = shift;
lib/Games/Board/Space.pm view on Meta::CPAN
unless eval { $args{board}->isa('Games::Board') };
my $space = {
id => $args{id},
board => $args{board},
};
$space->{dir} = $args{dir}
if $args{dir} and (ref $args{dir} eq 'HASH');
bless $space => $class;
}
#pod =method id
#pod
#pod This method returns the id of the space.
#pod
#pod =cut
sub id {
my $space = shift;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.532 second using v1.00-cache-2.02-grep-82fe00e-cpan-a086c87fca4 )