]> git.sesse.net Git - stockfish/commitdiff
Fix disambiguation bug in move_to_san()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 4 Dec 2011 11:24:15 +0000 (12:24 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 4 Dec 2011 11:24:15 +0000 (12:24 +0100)
A pinned piece cannot move and so does not play any role
in SAN disambiguation.

Reported by Steven Edwards.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/move.cpp

index 1a312cbc90e0e2f5744da9dae64a9e98fa92adf7..d079ee7b56f840b4aaebe61c48066446eb49fe34 100644 (file)
@@ -106,6 +106,10 @@ const string move_to_san(Position& pos, Move m) {
           {
               sq = pop_1st_bit(&attackers);
 
+              // Pinned pieces are not included in the possible sub-set
+              if (!pos.pl_move_is_legal(make_move(sq, to), pos.pinned_pieces()))
+                  continue;
+
               if (file_of(sq) == file_of(from))
                   ambiguousFile = true;