I have created a chess engine in Python and now want to start using the endgame tables in syzygy. I have downloaded all the relevant files and is now ready to start.

I have found how to access the files in Python via e.g. the Python Chess module (link). It there explains how I can get the WDL and DTZ information from a FEN position, which could be handy at times. BUT what I really want is to know the move to make to win in that FEN position, and I have not been able to figure out how to obtain this information from the files. The information online is very limited and I hope someone can please guide me on how to do this?

1 Answer 1


I can't be absolutely certain, as these particular tablebases are unfamiliar to me. However, in all other tablebases that I've used, from the Thompson and forward, you had, basically, to:

  1. generate all legal moves from the position,
  2. for each move, make the move and look up the score for the resulting position, and then
  3. select 'the right move' based on those retrieved scores, compared to the score for the starting position.
  • That sounds one way to solve it. Calculate all moves and see what move changes the DTZ by 1. Thank you! I will wait a day or two to see if someone has gotten a more clean solution, otherwise I will mark this as accepted.
    – Eli
    Commented Nov 30, 2020 at 7:57
  • @Eli what kind of cleaner solution are you hoping for? For space efficiency reasons such tablebases always only store the game theoretical value (e.g., win - draw - loss, or DTZ). They do not directly contain any moves as that would be a waste of space. So this is indeed the way to solve things (of course there may be libraries that do it for you but internally they would have to do exactly that).
    – koedem
    Commented Nov 30, 2020 at 11:35
  • @koedem, no need for the attitude. I am new to this and wanted to know how to do it the easiest way. Even AThulin said he wasn't sure if there was another way, hence I wanted to wait a bit. Was that so wrong?
    – Eli
    Commented Dec 2, 2020 at 5:05
  • @Eli Huh? I didn't intend to be mean or anything, I just asked what kind of answer you are looking for. I wrote roughly how tablebases work. You asked for a more clean solution so I asked what exactly you would consider such a cleaner solution.
    – koedem
    Commented Dec 2, 2020 at 11:50
  • 1
    @koedem, okay. What I hoped was to put in a FEN position (or similar) and get the best move as output. Best move = shortest way to victory if WDL is 1 or 2, maintaining D if WDL is 0, or longest way to losing if WDL in -1 or -2. I know understand that this information is not provided in the syzygy tables.
    – Eli
    Commented Dec 14, 2020 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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