Game::Battleship::Craft
version 0.0602
use Game::Battleship::Craft; my $craft = Game::Battleship::Craft->new( id => 'T', name => 'tug boat', points => 1, ) my $points_remaining = $craft->hit;
A Game::Battleship::Craft object represents the profile of a Battleship craft.
id => $STRING
A scalar identifier to use to indicate position on the grid. If one is not provided, the upper-cased first name character will be used by default.
Currently, it is required that this be a single uppercase letter (the first letter of the craft name, probably), since a hit will be indicated by "lower-casing" this mark on a player grid.
hit
name => $STRING
A required attribute provided to give the craft a name.
points => $INTEGER
The number of total points that a craft is worth.
position => [$X, $Y]
The position of the craft bow ("nose") on the grid.
orient => $BOOLEAN
The vertical or horizontal orientation of the craft.
Set this to 0 for vertical and 1 for horizontal.
0
1
If not defined, the craft is randomly oriented on creation.
hits => $INTEGER
Computed
$points_remaining = $craft->hit;
Increment the craft's hit attribute value and return what's left of the craft (total point value minus the number of hits).
Have different numbers of different weapons.
Allow a craft to have a width.
Gene Boggs <gene@cpan.org>
This software is copyright (c) 2020 by Gene Boggs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Game::Battleship, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Game::Battleship
CPAN shell
perl -MCPAN -e shell install Game::Battleship
For more information on module installation, please visit the detailed CPAN module installation guide.