Games-Perlwar
view release on metacpan or search on metacpan
lib/Games/Perlwar.pm view on Meta::CPAN
my $pw = new Games::Perlwar;
$pw->{interactive} = 1;
$pw->{theArray} = [ { owner => 'Yanick', name => 'Neo', code => 'print "Hello world!"' },
{ owner => '1337 h4ck3r', name => 'crash me', code => 'exit' },
{ owner => '1337 h4ck3r', name => 'readdir me', code => 'opendir DIR, "."; return readdir DIR;' },
{ owner => '1337 h4ck3r', name => 'infinite loop', code => '1 while 1' },
{ owner => '1337 h4ck3r', name => 'backticks', code => '`ls`' },
{ owner => '1337 h4ck3r', name => 'kill next', code => '"!1"' },
{ owner => '1337 h4ck3r', name => 'must die', code => '"I am still alive?"' },
{ owner => 'Yanick', name => 'good boy', code => '1' },
{ owner => 'Yanick', name => 'owner', code => '"~-1"' },
{ owner => 'Yanick', name => 'too big', code => 'a' x 200 },
];
$pw->{config}{arraySize} = @{ $pw->{theArray} };
$pw->{config}{maxSnippetSize} = 100;
$pw->runSlot( $_ ) for 0..9;
=end notes
lib/Games/Perlwar/Rules.pod view on Meta::CPAN
$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.
( run in 0.580 second using v1.01-cache-2.11-cpan-39bf76dae61 )