lpst.pl - fixed divide by zero error.

This commit is contained in:
gashapwn 2021-04-04 05:31:12 +00:00
parent 15f96766da
commit 72d58c9d8a

12
lpst.pl
View File

@ -468,7 +468,7 @@ sub calc_move($$){
$x_shift = $mov->[0]; $x_shift = $mov->[0];
# make adjustment # make adjustment
$ni = ($y_shift / ($y_shift * -1)); $ni = $y_shift != 0 ? ($y_shift / ($y_shift * -1)) : -1;
$ni *= -1; $ni *= -1;
$n0 = ($r0 + 1) % 2; $n0 = ($r0 + 1) % 2;
@ -495,12 +495,12 @@ binmode(STDOUT, ":utf8");
}(1...11); }(1...11);
my $m1 = "F4"; my $m1 = "F4";
my $c1 = $MG_A; my $c1 = $MG_QS;
$board{$m1} = $P1.$DIV.$c; $board{$m1} = $P1.$DIV.$c1;
for my $mv in $MOVE{} for my $mv (@{$MOVE{$c1}}){
printf("%s\n", calc_move($m1, [-2,-2])); printf("%s\n", calc_move($m1, $mv));
# printf("%s\n", calc_move($m1, [-6,6])); }
disp_board(); disp_board();