lpst.pl - fixed sylph offset bug

This commit is contained in:
gashapwn 2021-04-05 01:35:54 +00:00
parent 0f942f4fb8
commit 5e51a8c1b5

183
lpst.pl
View File

@ -152,8 +152,8 @@ my $ERR_C_1 = -1;
my %MOVE = ( my %MOVE = (
$MG_A => [ $MG_A => [
MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 0, 1], "type" => $MOVBLOCK_ENUM)
], ],
$MG_Q => [ $MG_Q => [
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM),
@ -162,27 +162,44 @@ my %MOVE = (
MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM)
], ],
$MG_I => [ $MG_I => [
MoveStruct->new("mov" => [0,0], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [-1, 0], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 0], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $BLOCK_ENUM)
], ],
$MG_IT => [ $MG_IT => [
MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM)
], ],
$MG_N => [ $MG_N => [
MoveStruct->new("mov" => [-1, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1,-2], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 1,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM)
], ],
$MG_H => [ $MG_H => [
MoveStruct->new("mov" => [-3, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-3, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 3,-2], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 3,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM)
], ],
$MG_RC => [ $MG_RC => [
MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-2, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 2, 0], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 2, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM)
], ],
$MG_S => [ $MG_S => [
MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM),
@ -198,37 +215,46 @@ my %MOVE = (
MoveStruct->new("mov" => [-3, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-3, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-2,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 2, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 2, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 3,-1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 3,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-2, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM)
], ],
$MG_RO => [ $MG_RO => [
MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1,-2], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 1,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1, 0], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 0], "type" => $BLOCK_ENUM)
], ],
$MG_B => [ $MG_B => [
MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 2,-2], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 2,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $BLOCK_ENUM)
], ],
$MG_P => [ $MG_P => [
MoveStruct->new("mov" => [-4, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-4, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-2, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [-2,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1,-1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 2,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 2,-1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 2, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 2, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 4,-2], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 4,-2], "type" => $MOVE_ENUM)
], ],
$MG_IM => [ $MG_IM => [
MoveStruct->new("mov" => [-2, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [-1,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1,-1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [-1, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 2], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 2,-1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 1,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 2,-1], "type" => $MOVBLOCK_ENUM)
], ],
$MG_F => [ $MG_F => [
MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM),
@ -236,49 +262,76 @@ my %MOVE = (
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 2, 0], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 2,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 2,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1, 2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-2, 0], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-2, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-2, 2], "type" => $BLOCK_ENUM)
], ],
$MG_QS => [ $MG_QS => [
MoveStruct->new("mov" => [-3, 3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-3, 3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-2, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-2, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 2, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 2, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 2,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 2,-2], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 3,-3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 3,-3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 3, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 3, 0], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-3, 0], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [-3, 0], "type" => $MOVE_ENUM)
], ],
$MG_AU => [ $MG_AU => [
MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 0], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 0], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 1,-1], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 2,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 2,-2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1, 2], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-1,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-2, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [-2, 2], "type" => $BLOCK_ENUM)
], ],
$MG_SY => [ $MG_SY => [
MoveStruct->new("mov" => [-4, 4], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-4, 4], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-3, 3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-3, 3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-3, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-3, 2], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [-1,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-1,-2], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 0,-4], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-4], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0,-3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0,-3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 0, 4], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 4], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 1, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 1, 2], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 3,-2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 3,-2], "type" => $MOVBLOCK_ENUM),
MoveStruct->new("mov" => [ 3,-3], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 3,-3], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [ 4,-4], "type" => $MOVE_ENUM) MoveStruct->new("mov" => [ 4,-4], "type" => $MOVE_ENUM),
MoveStruct->new("mov" => [-1, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0, 1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 0,-1], "type" => $BLOCK_ENUM),
MoveStruct->new("mov" => [ 1,-1], "type" => $BLOCK_ENUM)
] ]
); );
@ -536,7 +589,9 @@ sub cell_index_rev($$){
} }
sub cell_index($){ sub cell_index($){
my ($chr1, $chr2) = (split(//, $_[0])); my $chr1 = substr($_[0], 0,1);
my $chr2 = substr($_[0], 1,length($_[0])-1);
# my ($chr1, $chr2) = (split(//, $_[0]));
return ($AXIS{$chr1}, $chr2); return ($AXIS{$chr1}, $chr2);
} }
@ -581,8 +636,12 @@ sub calc_move($$){
# moving up: $ni == +1 want value of 1 # moving up: $ni == +1 want value of 1
$n0 = ($r0 + (($ni + 1)/2) ) % 2; $n0 = ($r0 + (($ni + 1)/2) ) % 2;
$x_shift += int(($y_shift + ($n0 * $ni)) / 2); $x_shift += int(($y_shift + ($n0 * $ni)) / 2);
return apply_shift($not, [$x_shift, $y_shift]); {
my $app_shift = apply_shift($not, [$x_shift, $y_shift]);
return $app_shift;
}
# return apply_shift($not, [$x_shift, $y_shift]);
} }
@ -625,9 +684,9 @@ binmode(STDOUT, ":utf8");
$AXIS_RV{$_} $AXIS_RV{$_}
}(1...11); }(1...11);
my $m1 = "F7"; # my $m1 = "F7";
# my $m1 = "A1"; my $m1 = "C10";
my $c1 = $MG_QS; my $c1 = $MG_SY;
$board{$m1} = $P1.$DIV.$c1; $board{$m1} = $P1.$DIV.$c1;
shade_move($m1, $MOVBLOCK_ENUM); shade_move($m1, $MOVBLOCK_ENUM);