Don't unnecessarily call Move.san

Greatly improves performance!
parent 5279dd45
Pipeline #20034221 canceled with stages
......@@ -349,11 +349,12 @@ class Move(namedtuple('Move', ['origin', 'destination', 'piece', 'captured',
piece, file, rank, destination, promotion = match.groups()
for move in ruleset.moves(position):
move_san = move.san(position, ruleset)
if not strict:
move_san = stripped_san(move_san)
if move_san == san:
return move
if strict or castling:
move_san = move.san(position, ruleset)
if not strict:
move_san = stripped_san(move_san)
if move_san == san:
return move
# pylint: disable=too-many-boolean-expressions
if (
strict
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment