KDE Bug 333256 detailed the problem that the string sent to a chess engine utilizing the xboard protocol during pawn promotion is incorrect. It was marked solved during a re-write of the xboard protocol code. However, the issue was never actually fixed. The error is the string sent to a chess engine using Xboard protocol is for example e7e8=q. However, the Xboard specification is e7e8q. While the first string will work with several chess engines, the majority of engines will not recognize the string and cause knights to freeze. Knights will successfully read a proper xboard pawn promotion string from a chess engine then display it in engine output log, report it in history, and change the piece on the chess board. It is when it transmits the move to the opponent chess engine utilizing the incorrect xboard string that the problem occurs. Knights makes up the Xboard protocol string from its own internal move string. The bug is in the xboard string creation for pawn promotion routine. The routine that reads the xboard pawn promotion string is OK.
Created attachment 147654 [details] Patch file Bug 447665 Knights utilizes code found in xboardprotocol.cpp to create a move string. The string describes the chess move in Xboard protocol to be sent to an Xboard compliant chess engine. To generate a move string including a pawn promotion, the Knights code starts out with a generic call to move.cpp to create a string. An example string returned is: e7e8=Q Then the string is modified in xboardprotocol.cpp to remove all capitals: e7e8=q This string is then sent to the chess engine. But the xboard protocol documentation requires the string to be: e7e8q Early on in chess engine development there were multiple formats to communicate with chess engines. Some utilzed an = sign between move and promotion piece. But the Xboard system slowly became the standard for communication. Some chess engines will also accept the = sign in Xboard mode to be historically compatable. Specifically, the following engines will accept the = sign and will run: GNUchess6, Crafty, Phalanx XXV and Gully2. Other (usually newer) engines require the correct Xboard protocol. They will stop play with an illegal move response if the move contains the = sign. Some examples are: Greko, Dreamer, Sloppy, Beowulf and Prophet4. A patch was developed based upon the UCI code to generate the correct Xboard move string. That patch is attached to this note. When applied to the Knights code, **ALL** of the above engines accept the pawn promotion move and continue to play.
Git commit d7880a9ab4643d2800e4a918b6b0f8aa93d89999 by Alexander Semke, on behalf of David Kaye. Committed on 15/04/2022 at 08:05. Pushed by asemke into branch 'master'. Fixed incorrect promotion in the XBoard protocol. To generate a move string including a pawn promotion, the Knights code starts out with a generic call to move.cpp to create a string. An example string returned is: e7e8=Q Then the string is modified in xboardprotocol.cpp to remove all capitals: e7e8=q This string is then sent to the chess engine. But the xboard protocol documentation requires the string to be: e7e8q Early on in chess engine development there were multiple formats to communicate with chess engines. Some utilzed an = sign between move and promotion piece. But the Xboard system slowly became the standard for communication. Some chess engines will also accept the = sign in Xboard mode to be historically compatable. Specifically, the following engines will accept the = sign and will run: GNUchess6, Crafty, Phalanx XXV and Gully2. Other (usually newer) engines require the correct Xboard protocol. They will stop play with an illegal move response if the move contains the = sign. Some examples are: Greko, Dreamer, Sloppy, Beowulf and Prophet4. With this fix the behavior is more correct and all of the above engines accept the pawn promotion move and continue to play. FIXED-IN: 22.08 M +2 -2 src/proto/xboardprotocol.cpp https://invent.kde.org/games/knights/commit/d7880a9ab4643d2800e4a918b6b0f8aa93d89999