lpst.pl - refactored whitespace. fixed col, row swap bug. time for bed

This commit is contained in:
gashapwn 2021-04-04 06:07:03 +00:00
parent 72d58c9d8a
commit 00b7fc7b84

130
lpst.pl
View File

@ -95,132 +95,66 @@ my %AXIS_RV = map {
my %MOVE = (
$MG_A => [
[-1, 1],
[ 0, 1]
[-1, 1], [ 0, 1]
],
$MG_Q => [
[ 0, 1],
[ 1, 0],
[-1, 0],
[ 0,-1],
[ 0, 1], [ 1, 0], [-1, 0], [ 0,-1],
],
$MG_I => [
[0,0]
],
$MG_IT => [
[ 0,-1],
[ 1,-1]
[ 0,-1], [ 1,-1]
],
$MG_N => [
[-1, 2],
[ 1,-2]
],
$MG_H => [
[-3, 2],
[-1,-2],
[ 1, 2],
[ 3,-2]
[-3, 2], [-1,-2], [ 1, 2], [ 3,-2]
],
$MG_RC => [
[-1, 0],
[-2, 0],
[ 0, 1],
[ 0, 2]
[-1, 0], [-2, 0], [ 0, 1], [ 0, 2]
],
$MG_S => [
[-1, 1],
[-2, 2],
[ 0, 1],
[ 0, 2],
[ 0,-1],
[ 0,-2],
[ 1,-1],
[ 2,-2],
[-1, 1], [-2, 2], [ 0, 1], [ 0, 2],
[ 0,-1], [ 0,-2], [ 1,-1], [ 2,-2],
],
$MG_HS => [
[-3, 1],
[-2,-1],
[ 2, 1],
[ 3,-1]
[-3, 1], [-2,-1], [ 2, 1], [ 3,-1]
],
$MG_RO => [
[-1, 1],
[ 0, 1],
[ 1, 1],
[ 1,-2]
[-1, 1], [ 0, 1], [ 1, 1], [ 1,-2]
],
$MG_B => [
[-1, 1],
[ 0, 1],
[ 0,-2],
[ 1,-2]
[-1, 1], [ 0, 1], [ 0,-2], [ 1,-2]
],
$MG_P => [
[-4, 2],
[-2, 1],
[-2,-2],
[-1,-1],
[ 1, 1],
[ 2,-1],
[ 2, 2],
[ 4,-2]
[-4, 2], [-2, 1], [-2,-2], [-1,-1],
[ 1, 1], [ 2,-1], [ 2, 2], [ 4,-2]
],
$MG_IM => [
[-2, 1],
[-1,-1],
[-1, 2],
[ 1, 1],
[ 1,-1],
[ 1,-2],
[ 2,-1]
[-2, 1], [-1,-1], [-1, 2], [ 1, 1],
[ 1,-1], [ 1,-2], [ 2,-1]
],
$MG_F => [
[-1, 0],
[-1, 1],
[ 0, 1],
[ 0,-1],
[ 1, 0],
[ 1,-1]
[-1, 0], [-1, 1], [ 0, 1], [ 0,-1],
[ 1, 0], [ 1,-1]
],
$MG_QS => [
[-3, 3],
[-2, 2],
[-2, 0],
[-1, 0],
[-1, 1],
[ 0, 1],
[ 0, 2],
[ 0, 3],
[ 0,-1],
[ 0,-2],
[ 0,-3],
[ 1, 0],
[ 1,-1],
[ 2, 0],
[ 2,-2],
[ 3,-3],
[-3, 3], [-2, 2], [-2, 0], [-1, 0],
[-1, 1], [ 0, 1], [ 0, 2], [ 0, 3],
[ 0,-1], [ 0,-2], [ 0,-3], [ 1, 0],
[ 1,-1], [ 2, 0], [ 2,-2], [ 3,-3],
],
$MG_AU => [
[-1, 0],
[-1, 1],
[ 0, 1],
[ 0,-1],
[ 1, 0],
[ 1,-1]
[-1, 0], [-1, 1], [ 0, 1], [ 0,-1],
[ 1, 0], [ 1,-1]
],
$MG_SY => [
[-4, 4],
[-3, 3],
[-3, 2],
[-1,-2],
[ 0,-2],
[ 0,-3],
[ 0, 3],
[ 0, 4],
[ 1, 2],
[ 3,-2],
[ 3,-3],
[ 4,-4]
[-4, 4], [-3, 3], [-3, 2], [-1,-2],
[ 0,-2], [ 0,-3], [ 0, 3], [ 0, 4],
[ 1, 2], [ 3,-2], [ 3,-3], [ 4,-4]
]
);
@ -459,20 +393,18 @@ sub calc_move($$){
my $n0;
my $ni;
($r0, $c0) = cell_index($not);
($c0, $r0) = cell_index($not);
# Calc y_shift
# get y_shift
$y_shift = $mov->[1];
# Calc x_shift
# get x_shift
$x_shift = $mov->[0];
# make adjustment
# make x_shift adjustment
$ni = $y_shift != 0 ? ($y_shift / ($y_shift * -1)) : -1;
$ni *= -1;
$n0 = ($r0 + 1) % 2;
$x_shift += int(($y_shift + ($n0 * $ni)) / 2);
return apply_shift($not, [$x_shift, $y_shift]);
@ -494,8 +426,8 @@ binmode(STDOUT, ":utf8");
$AXIS_RV{$_}
}(1...11);
my $m1 = "F4";
my $c1 = $MG_QS;
my $m1 = "E6";
my $c1 = $MG_A;
$board{$m1} = $P1.$DIV.$c1;