Forums

I'm building my own chess engine for endgames in Python But I've got stuck

Sort:
mnaf2

  
I have just upgraded my code for computing completely optimally for both players a chess endgame as given here: https://pastebin.com/jQ090L01 but it gives to me 2 plies to checkmate White instead of correct 4 plies according to StockFish.

Can someone give me a hint how to fix this and where is the source of the problem? The code is correct in the sense that it detects correctly the game_tree[1]['result']: -1 for black win, 1 for white's and 0 for a draw. But it gives wrong plies to mate.ChatGPT4 hasn't helped.

tygxc

1 move = 2 plies?

mnaf2

Yes, 1 move = 2 plies.

A more updated version of my problem is here:

https://lichess.org/forum/off-topic-discussion/i-have-a-problem-with-pythons-code-designed-to-solve-trivial-endgames-2