}
// Pawn captures always use disambiguation
- if ((n == NOTATION_SAN || n == NOTATION_LAN) && pt == PAWN && pos.capture(m) && from != to)
- return FILE_DISAMBIGUATION;
+ if (n == NOTATION_SAN && pt == PAWN)
+ {
+ if (pos.capture(m))
+ return FILE_DISAMBIGUATION;
+ if (type_of(m) == PROMOTION && from != to && pos.sittuyin_promotion())
+ return SQUARE_DISAMBIGUATION;
+ }
// A disambiguation occurs if we have more then one piece of type 'pt'
// that can reach 'to' with a legal move.
Bitboard others, b;
- others = b = ((pos.capture(m) ? attacks_bb(~us, pt == HORSE ? KNIGHT : pt, to, pos.pieces())
- : moves_bb( ~us, pt == HORSE ? KNIGHT : pt, to, pos.pieces())) & pos.pieces(us, pt)) & ~square_bb(from);
+ others = b = ((pos.capture(m) ? attacks_bb(~us, pt, to, AttackRiderTypes[pt] & ASYMMETRICAL_RIDERS ? Bitboard(0) : pos.pieces())
+ : moves_bb( ~us, pt, to, MoveRiderTypes[pt] & ASYMMETRICAL_RIDERS ? Bitboard(0) : pos.pieces()))
+ & pos.pieces(us, pt)) & ~square_bb(from);
while (b)
{
else
san += '-';
}
- else if (pos.capture(m) && from != to)
+ else if (pos.capture(m))
san += 'x';
else if (n == NOTATION_LAN || n == NOTATION_SHOGI_HODGES || (n == NOTATION_SHOGI_HOSKING && d == SQUARE_DISAMBIGUATION) || n == NOTATION_JANGGI)
san += '-';
result = sf.get_san("chess", fen, "c7b8q")
self.assertEqual(result, "cxb8=Q+")
+ fen = "1r2k3/P1P5/8/8/8/8/8/4K3 w - - 0 1"
+ result = sf.get_san("chess", fen, "c7b8q", False, sf.NOTATION_LAN)
+ self.assertEqual(result, "c7xb8=Q+")
+
result = sf.get_san("capablanca", CAPA, "e2e4")
self.assertEqual(result, "e4")
result = sf.get_san("sittuyin", fen, "h4h4f")
self.assertEqual(result, "h4=F")
+ fen = "k7/2K3P1/8/4P3/8/8/8/1R6[] w - - 0 1"
+ result = sf.get_san("sittuyin", fen, "e5f6f")
+ self.assertEqual(result, "e5f6=F")
+
result = sf.get_san("shogi", SHOGI, "i3i4")
self.assertEqual(result, "P-1f")