LPST.pm - added fix for tricking notation test.pl - updated test cases
This commit is contained in:
parent
b3ee9aa4c8
commit
8136c1e191
18
LPST.pm
18
LPST.pm
@ -780,11 +780,20 @@ sub check_valid_cell($$){
|
|||||||
# } keys %board;
|
# } keys %board;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_src_cell($$$){
|
sub check_match_pi($$$$){
|
||||||
my ($self, $hx1, $apl) = (shift, shift, shift);
|
my ($self, $hx1, $pi) = (shift, shift, shift);
|
||||||
|
my $hx2;
|
||||||
|
|
||||||
|
$hx2 = $self->cell_pi($hx1);
|
||||||
|
die "$pi - Wrong piece notation for $hx1 should be $hx2" if $hx2 ne $pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub check_src_cell($$$$){
|
||||||
|
my ($self, $hx1, $apl, $pi) = (shift, shift, shift, shift);
|
||||||
$hx1 = uc $hx1;
|
$hx1 = uc $hx1;
|
||||||
|
|
||||||
$self->check_nonempty_cell($hx1);
|
$self->check_nonempty_cell($hx1);
|
||||||
|
$self->check_match_pi($hx1, $pi);
|
||||||
die "This cell is not owned by $apl" if $self->cell_pl($hx1) ne $apl;
|
die "This cell is not owned by $apl" if $self->cell_pl($hx1) ne $apl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,11 +876,12 @@ sub ft_summon($$$){
|
|||||||
|
|
||||||
sub mov($$$){
|
sub mov($$$){
|
||||||
my ($self, $s0, $apl) = (shift, shift, shift);
|
my ($self, $s0, $apl) = (shift, shift, shift);
|
||||||
my ($src, $dst) = $s0 =~ /([A-Za-z][0-9]{1,2})([A-Za-z][0-9]{1,2})$/;
|
my ($pi, $src, $dst) = $s0 =~ /([A-Za-z]){1,2}([A-Za-z][0-9]{1,2})([A-Za-z][0-9]{1,2})$/;
|
||||||
|
|
||||||
$src = uc $src;
|
$src = uc $src;
|
||||||
$dst = uc $dst;
|
$dst = uc $dst;
|
||||||
$self->check_valid_player($apl);
|
$self->check_valid_player($apl);
|
||||||
$self->check_src_cell($src, $apl);
|
$self->check_src_cell($src, $apl, $pi);
|
||||||
$self->check_empty_cell($dst);
|
$self->check_empty_cell($dst);
|
||||||
$self->check_valid_mov($src, $dst);
|
$self->check_valid_mov($src, $dst);
|
||||||
$self->{"board"}{$dst} = $self->cell_pl($src).$DIV.$self->cell_pi($src);
|
$self->{"board"}{$dst} = $self->cell_pl($src).$DIV.$self->cell_pi($src);
|
||||||
|
Loading…
Reference in New Issue
Block a user