LPST.pm - updates player hand ntvl.pl - updated test cases
This commit is contained in:
parent
c057039549
commit
7f92f1f269
12
LPST.pm
12
LPST.pm
@ -82,6 +82,11 @@ my @MG_PI = (
|
|||||||
my $P1 = "P1";
|
my $P1 = "P1";
|
||||||
my $P2 = "P2";
|
my $P2 = "P2";
|
||||||
|
|
||||||
|
my %HAND = (
|
||||||
|
$P1 => [],
|
||||||
|
$P2 => []
|
||||||
|
);
|
||||||
|
|
||||||
my $DIV = ":";
|
my $DIV = ":";
|
||||||
|
|
||||||
my %AXIS = (
|
my %AXIS = (
|
||||||
@ -718,12 +723,15 @@ sub get_block_cell($){
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub draw($$){
|
sub draw($$){
|
||||||
my ($self, $s0) = (shift, shift);
|
my ($self, $s0, $apt) = (shift, shift, shift);
|
||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
for my $s1 (uniq( [split(/ /, $s0)] )){
|
for my $s1 (uniq( [split(/ /, $s0)] )){
|
||||||
$i++;
|
$i++;
|
||||||
die "invalid card - $s1" unless grep { $_ =~ /^$s1$/ } @MG_PI;
|
die "invalid card - $s1" unless grep {
|
||||||
|
$_ =~ /^$s1$/
|
||||||
|
} @MG_PI;
|
||||||
|
$HAND{$P1} = $s1;
|
||||||
}
|
}
|
||||||
die "draw() $s0 - hand size less than $HAND_SIZE. Possible duplicate card?" if $i < $HAND_SIZE;
|
die "draw() $s0 - hand size less than $HAND_SIZE. Possible duplicate card?" if $i < $HAND_SIZE;
|
||||||
}
|
}
|
||||||
|
2
ntvl.pl
2
ntvl.pl
@ -39,7 +39,7 @@ sub is_draw($){
|
|||||||
sub draw($$$){
|
sub draw($$$){
|
||||||
my ($b, $s0, $apl) = (shift, shift, shift);
|
my ($b, $s0, $apl) = (shift, shift, shift);
|
||||||
die "invalid draw() syntax $s0" unless $s0 =~ /^([A-Za-z]{1,2} ){4}[A-Za-z]{1,2}$/;
|
die "invalid draw() syntax $s0" unless $s0 =~ /^([A-Za-z]{1,2} ){4}[A-Za-z]{1,2}$/;
|
||||||
$b->draw($s0);
|
$b->draw($s0, $apl);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub mt2($$$$){
|
sub mt2($$$$){
|
||||||
|
Loading…
Reference in New Issue
Block a user