sources=sources,
extra_compile_args=args)
-setup(name="pyffish", version="0.0.66",
+setup(name="pyffish", version="0.0.67",
description="Fairy-Stockfish Python wrapper",
long_description=long_description,
long_description_content_type="text/markdown",
while (b)
{
Square s = pop_lsb(b);
- if ( pos.pseudo_legal(make_move(s, to))
- && pos.legal(make_move(s, to))
+ // Construct a potential move with identical special move flags
+ // and only a different "from" square.
+ Move testMove = Move(m ^ make_move(from, to) ^ make_move(s, to));
+ if ( pos.pseudo_legal(testMove)
+ && pos.legal(testMove)
&& !(is_shogi(n) && pos.unpromoted_piece_on(s) != pos.unpromoted_piece_on(from)))
others |= s;
}
result = sf.get_san("shogi", SHOGI, "f1e2", False, sf.NOTATION_SHOGI_HODGES_NUMBER)
self.assertEqual(result, "G49-58")
+ # Disambiguation of promotion moves
+ fen = "p1ksS/n1n2/4P/5/+L1K1+L[] b - - 3 9"
+ result = sf.get_san("kyotoshogi", fen, "c4b2+", False, sf.NOTATION_SHOGI_HODGES_NUMBER)
+ self.assertEqual(result, "N32-44+")
+ result = sf.get_san("kyotoshogi", fen, "a4b2+", False, sf.NOTATION_SHOGI_HODGES_NUMBER)
+ self.assertEqual(result, "N52-44+")
+
fen = "lnsgkgsnl/1r5b1/pppppp1pp/6p2/9/2P6/PP1PPPPPP/1B5R1/LNSGKGSNL w -"
result = sf.get_san("shogi", fen, "b2h8", False, sf.NOTATION_SHOGI_HODGES)
self.assertEqual(result, "Bx2b=")
result = sf.get_san("seirawan", fen, "h1e1e")
self.assertEqual(result, "O-O/Eh1")
+ # Disambiguation only when necessary
+ fen = "rnbqkb1r/ppp1pppp/5n2/3p4/3P4/5N2/PPP1PPPP/RNBQKB1R[EHeh] w KQABCDEFHkqabcdefh - 2 3"
+ result = sf.get_san("seirawan", fen, "b1d2e")
+ self.assertEqual(result, "Nd2/E")
+ result = sf.get_san("seirawan", fen, "b1d2")
+ self.assertEqual(result, "Nbd2")
+
def test_get_san_moves(self):
UCI_moves = ["e2e4", "e7e5", "g1f3", "b8c6h", "f1c4", "f8c5e"]
SAN_moves = ["e4", "e5", "Nf3", "Nc6/H", "Bc4", "Bc5/E"]