Commit d7880a9a authored by David Kaye's avatar David Kaye Committed by Alexander Semke
Browse files

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:
Then the string is modified in xboardprotocol.cpp to remove all capitals:
This string is then sent to the chess engine.  But the xboard protocol documentation requires the string to be:

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.

BUG: 447665
FIXED-IN: 22.08
parent bcb5d1dc
Pipeline #164394 passed with stage
in 2 minutes and 5 seconds
......@@ -73,9 +73,9 @@ void XBoardProtocol::startGame() {
void XBoardProtocol::move ( const Move& m ) {
QString str = m.string(false);
QString str = m.from().string() +;
if (m.promotedType())
str = str.toLower(); // "e7e8q" is used for the pawn promotion -> convert Q in the move string to lowercase q
str += Piece::charFromType ( m.promotedType() ).toLower();
qCDebug(LOG_KNIGHTS) << "Player's move:" << str;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment