#20 making "resign" work in engine matches

closed-fixed
None
5
2007-01-18
2007-01-17
Anonymous
No

This patch makes "Resign" from the menu work in engine matches. The old code simply sent the string "resign" to the engine, but that doesn't work (The winboard protocol defines "resign" as something the engine can send when resigning, not the other way around. Also, it doesn't appear as if eboard supports receiving "resign".).

I'll also note that the status bar notification is done three times - once for the "Resign" message, once for the "savePGN" message and once for the "Disconnect" message (from network->close), and there's no way the user can see the first two. This happens also at gameOver, so I decided not to change this.

Discussion

  • Nobody/Anonymous

    patch

     
  • Nobody/Anonymous

    Logged In: NO

    Now that I look at the spec again, sending the result command is recommended to allow the engine to use learning. so this is better:

    --- proto_xboard.cc 2007-01-17 05:59:07.658446424 +0200
    +++ proto_xboard.cc 2007-01-17 06:37:46.536687009 +0200
    @@ -370,8 +370,32 @@
    }

    void XBoardProtocol::resign() {
    - global.network->writeLine("resign");
    + ChessGame *refgame;
    +
    + global.gameLost();
    + refgame=getGame();
    + if (EngineWhite)
    + {
    + global.network->writeLine("result 0-1 {Black Resigns}");
    + refgame->endGame("Black resigned", WHITE_WIN);
    + }
    + else
    + {
    + global.network->writeLine("result 1-0 {White Resigns}");
    + refgame->endGame("White resigned", BLACK_WIN);
    + }
    global.status->setText(_("Resigned."),10);
    +
    + if (global.AppendPlayed) {
    + if (refgame->savePGN(global.AppendFile,true)) {
    + char z[128];
    + sprintf(z,_("Game appended to %s"),global.AppendFile);
    + global.status->setText(z,10);
    + }
    + }
    +
    + global.network->close();
    + global.network->sendReadNotify();
    }

    void XBoardProtocol::draw() {

     
  • Felipe Bergo

    Felipe Bergo - 2007-01-18
    • assigned_to: nobody --> bergo
    • status: open --> closed-fixed
     
  • Felipe Bergo

    Felipe Bergo - 2007-01-18

    Logged In: YES
    user_id=23863
    Originator: NO

    patch applied to CVS.

     

Log in to post a comment.