From 5e51a8c1b52eb1f7ac44e8234f388b071bbbc32a Mon Sep 17 00:00:00 2001 From: gashapwn Date: Mon, 5 Apr 2021 01:35:54 +0000 Subject: [PATCH] lpst.pl - fixed sylph offset bug --- lpst.pl | 183 ++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 121 insertions(+), 62 deletions(-) diff --git a/lpst.pl b/lpst.pl index 50aecd8..ac80cae 100644 --- a/lpst.pl +++ b/lpst.pl @@ -152,8 +152,8 @@ my $ERR_C_1 = -1; my %MOVE = ( $MG_A => [ - MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM) + MoveStruct->new("mov" => [-1, 1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 0, 1], "type" => $MOVBLOCK_ENUM) ], $MG_Q => [ MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), @@ -162,27 +162,44 @@ my %MOVE = ( MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM) ], $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 => [ 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 => [ 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 => [ 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" => [ 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 => [ MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [-2, 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 => [ 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" => [-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 => [ MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 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 => [ MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 0, 1], "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 => [ 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" => [-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,-1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 1, 1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 2,-1], "type" => $MOVBLOCK_ENUM), MoveStruct->new("mov" => [ 2, 2], "type" => $MOVE_ENUM), MoveStruct->new("mov" => [ 4,-2], "type" => $MOVE_ENUM) ], $MG_IM => [ - MoveStruct->new("mov" => [-2, 1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-1,-1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-1, 2], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 1, 1], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [-2, 1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [-1,-1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [-1, 2], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 1, 1], "type" => $MOVBLOCK_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 => [ 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" => [ 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 => [ - MoveStruct->new("mov" => [-3, 3], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-2, 2], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-2, 0], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0, 2], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0, 3], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0,-2], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 0,-3], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 2, 0], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 2,-2], "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, 3], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [-2, 2], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [-2, 0], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [-1, 0], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [-1, 1], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 0, 1], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 0, 2], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 0, 3], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 0,-1], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 0,-2], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 0,-3], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 1, 0], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 2, 0], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 2,-2], "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) ], $MG_AU => [ - MoveStruct->new("mov" => [-1, 0], "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, 0], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 1,-1], "type" => $MOVE_ENUM) + MoveStruct->new("mov" => [-1, 0], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [-1, 1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 0, 1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 0,-1], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 1, 0], "type" => $MOVBLOCK_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 => [ - MoveStruct->new("mov" => [-4, 4], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-3, 3], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-3, 2], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [-1,-2], "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, 4], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 1, 2], "type" => $MOVE_ENUM), - MoveStruct->new("mov" => [ 3,-2], "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" => [-3, 3], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [-3, 2], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [-1,-2], "type" => $MOVBLOCK_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, 4], "type" => $MOVE_ENUM), + MoveStruct->new("mov" => [ 1, 2], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 3,-2], "type" => $MOVBLOCK_ENUM), + MoveStruct->new("mov" => [ 3,-3], "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($){ - 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); } @@ -581,8 +636,12 @@ sub calc_move($$){ # moving up: $ni == +1 want value of 1 $n0 = ($r0 + (($ni + 1)/2) ) % 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{$_} }(1...11); -my $m1 = "F7"; -# my $m1 = "A1"; -my $c1 = $MG_QS; +# my $m1 = "F7"; +my $m1 = "C10"; +my $c1 = $MG_SY; $board{$m1} = $P1.$DIV.$c1; shade_move($m1, $MOVBLOCK_ENUM);