forked from martynsmith/dominion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.piirc
39 lines (33 loc) · 1 KB
/
.piirc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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();
}