LPST.pm - updates player hand ntvl.pl - updated test cases

This commit is contained in:
gashapwn 2021-04-09 01:54:45 +00:00
parent c057039549
commit 7f92f1f269
2 changed files with 11 additions and 3 deletions

12
LPST.pm
View File

@ -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;
} }

View File

@ -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($$$$){