Python Forum
a chess endgame problem, almost solved but not quite - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: a chess endgame problem, almost solved but not quite (/thread-41874.html)



a chess endgame problem, almost solved but not quite - max22 - Mar-31-2024

I'm trying to create a code for **perfectly optimal chess endgame**.
By that I mean that the loosing player tries to delay the checkmate as long as possible while the winning tries to checkmate the opponent as soon as possible.
This code for chess endgame is my currently best [one](https://pastebin.com/zkcbgANy)

However,for initial fen = "8/8/8/4k3/2K4R/8/8/8 w - - 0 1" it doesn't give the optimal result like this one: https://lichess.org/analysis/8/8/8/4k3/2K4R/8/8/8_w_-_-_0_1?color=white

Rather, it gives 27 plies [like this](https://pastebin.com/hZ6AaBZe) while lichess.com link above gives 1000-977==23 plies. Finding the bug will be highly appreciated.