1

Background: I wrote and use a custom macro in the NoteTab Pro text editor to convert PGN position analysis to XML. The resulting XML is used on my website to display chess puzzles. I need to check for legal moves in some cases. For example, a PGN move might say Rd6 in a position where two rooks can move to d6, but only one of them can legally move to d6 because the other is pinned to its King. I am disinclined to write a macro legal move checker due to the apparent complexity of the task. I do not want to reinvent the wheel.

Ideally, I am looking for an executable that can be called with FEN and next-move parameters, and return a positive or negative result based on the move's legality.

1

Simple problem. python-chess is a useful Python package that can do it for you easily. You will need to get a FEN, check if your move is a legal move.

https://pypi.org/project/python-chess/

has everything you want.

  • Hmmm... It will take me some time to digest Python-Chess. I don't speak Python. I am not sure what a package is, or what this specific package can do. Do you know of any tutorial to get a novice started with Python and this package? Until then I will take your word for it and accept your answer. Thanks. – clueless Dec 11 '18 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.