Games-Perlwar
view release on metacpan or search on metacpan
lib/Games/Perlwar/Rules.pod view on Meta::CPAN
=over
=item $x:$y
Copy the code of cell $x of @_ (as defined after execution of the agent) into position
$y of the Array (relative to the position of the current agent). $x and $y must be
integers with an absolute value between 0 and $#_.
If either $x or $y are not explicitly given, they default to
the position 0. If the destination position is already occupied by an agent belonging to
a different player, the copy fails. If the copy succeed, the newly copied agent will only become operational during the next iteration (i.e., it will not be executed during
the current iteration).
Example:
# crawler - copy itself to the next position
return ":1"
=item !$x
Nuke the agent presents in position $x. The cell then
returns to its empty and unowned state. If $x is not given, defaults to 0.
Example:
# berserker
return '!'.1+int(rand(@_))
=item ~$x
Update the agent in position $x of the Array by its counterpart in @_. If $x is not explicitly given,
defaults to 0. Ownership of the modified agent isn't modified. If an agent isn't present,
nothing happens.
Example:
# drive neighbor to suicide
$_[1] =~ s//return "!"/;
return "~1";
=item ^$x
Claim ownership of the agent in position $x of the Array. If there is no agent at that
position, nothing happens.
Example:
# crawling borg
$pos = 1;
s/\d+/$&+1/e;
return "^$pos";
=back
=head1 END OF GAME
The game ends once the final round is played, or until all but one player have been eliminated.
The winner of the game is the player with the most agents still alive
in the Array.
=head1 GAME VARIANTS
=over
=item Mambo War
In this variant, the agent maximal size is decremented after each turn.
=back
=head1 VERSION
This document describes the rules of Perlwar as implemented
in Games::Perlwar v0.03.
=cut
'end of Games::Perlwar::Rules';
( run in 1.337 second using v1.01-cache-2.11-cpan-97f6503c9c8 )