Python Forum

Full Version: a chess endgame problem, almost solved but not quite
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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/2...olor=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.