Yet more Chess960 castling fixes.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 9 Feb 2018 21:00:44 +0000 (22:00 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 9 Feb 2018 21:00:44 +0000 (22:00 +0100)
Position.pm

index 8cfc4a6..3e3e84f 100644 (file)
@@ -74,7 +74,7 @@ sub from_fen {
        if ($castling =~ /Q/) {
                $pos->{'white_castle_q'} = _col_num_to_letter(_find_piece_col($board->[7], 'R'));
        }
        if ($castling =~ /Q/) {
                $pos->{'white_castle_q'} = _col_num_to_letter(_find_piece_col($board->[7], 'R'));
        }
-       while ($castling =~ s/([A-H])//g) {
+       while ($castling =~ s/([A-H])//) {
                my $rook_col = lc($1);
                my $king_col = _col_num_to_letter(_find_piece_col($board->[7], 'K'));
                if ($rook_col lt $king_col) {
                my $rook_col = lc($1);
                my $king_col = _col_num_to_letter(_find_piece_col($board->[7], 'K'));
                if ($rook_col lt $king_col) {
@@ -89,7 +89,7 @@ sub from_fen {
        if ($castling =~ /q/) {
                $pos->{'black_castle_q'} = _col_num_to_letter(_find_piece_col($board->[0], 'r'));
        }
        if ($castling =~ /q/) {
                $pos->{'black_castle_q'} = _col_num_to_letter(_find_piece_col($board->[0], 'r'));
        }
-       while ($castling =~ s/([a-h])//g) {
+       while ($castling =~ s/([a-h])//) {
                my $rook_col = $1;
                my $king_col = _col_num_to_letter(_find_piece_col($board->[0], 'k'));
                if ($rook_col lt $king_col) {
                my $rook_col = $1;
                my $king_col = _col_num_to_letter(_find_piece_col($board->[0], 'k'));
                if ($rook_col lt $king_col) {