Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (33 sloc) 1.029 kb
# vim:filetype=perl
use List::MoreUtils qw(uniq);
use Dominion::Game;
$g = Dominion::Game->new;
$s = $g->supply;
$p1 = Dominion::Player->new(name => 'Martyn');
$p2 = Dominion::Player->new(name => 'Fred');
$p3 = Dominion::Player->new(name => 'Harold');
my $cb = sub { my ($self, $data) = @_; print $self->name, ' => ', $data->{state}, "\n"; };
$p1->add_listener('action', $cb);
$p1->add_listener('buy', $cb);
$p2->add_listener('action', $cb);
$p2->add_listener('buy', $cb);
$p3->add_listener('action', $cb);
$p3->add_listener('buy', $cb);
$g->player_add($p1);
$g->player_add($p2);
$g->player_add($p3);
sub supply {
uniq map { ref } $s->cards;
}
sub cards {
my ($player) = @_;
{
play => [ map { ref } $player->playarea->cards ],
hand => [ map { ref } $player->hand->cards ],
discard => [ map { ref } $player->discard->cards ],
deck => [ map { ref } $player->deck->cards ],
}
}
sub not_implemented {
sort grep { not $_->can('action') } Dominion::Cards->action();
}
Jump to Line
Something went wrong with that request. Please try again.