Games::Risk::Country - map country
version 3.112410
my $country = Games::Risk::Country->new(\%params);
This module implements a map country, with all its characteristics.
my $country = Games::Risk::Country->new( \%params )
Create a new country. Mandatory params are name, continent, greyval, x and y (see below in Accessors section for a quick definition of those params). Other attributes are optional, but can be supplied anyway.
name
continent
greyval
x
y
Accessors
The following accessors (acting as mutators, ie getters and setters) are available for Games::Risk::Country objects:
Games::Risk::Country
armies()
number of armies currently in the country.
continent()
a Games::Risk::Continent object in which the country is located.
Games::Risk::Continent
greyval()
an integer between 1 and 254 corresponding at the grey (all RGB values set to greyval()) used to draw the country on the grey-scale map.
id()
alias for greyval().
name()
country name.
owner()
a Games::Risk::Player object currently owning the country.
Games::Risk::Player
coordx()
the x location of the country capital.
coordy()
the y location of the country capital.
$country->chown( $player )
Change the owner of the $country to be $player. This implies updating cross-reference for previous owner and new one.
$country
$player
$country->destroy()
Remove all circular references of $country, to prevent memory leaks.
my $bool = $country->is_neighbour( $c )
Return true if $country is a neighbour of country $c, false otherwise.
$c
my @neighbours = $country->neighbours()
Return the list of $country's neighbours.
$country->neighbour_add( $c )
Add $c to the list of $country's neighbours. This is not reciprocical.
Games::Risk.
Jerome Quelin
This software is Copyright (c) 2008 by Jerome Quelin.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
To install Games::Risk, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Risk
CPAN shell
perl -MCPAN -e shell install Games::Risk
For more information on module installation, please visit the detailed CPAN module installation guide.