test on the UI failed

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

test on the UI failed

Postby gpapas123 » 26 Sep 2017, 12:14

Hello Winboard experts:
My naive program to test winboard command flow is as follows:
Code: Select all
/////////////////////////
// file main.cpp         //
// Main control structure   //
// plus xboard()         //
/////////////////////////

#include "stdafx.h"

using namespace std;

void xboard()
{
   char user[64];
   char moves[10][5];

   strcpy(moves[0],"a7a5");
   strcpy(moves[1],"b7b5");
   strcpy(moves[2],"c7c5");
   strcpy(moves[3],"d7d5");
   strcpy(moves[4],"e7e5");
   strcpy(moves[5],"f7f5");
   strcpy(moves[6],"g7g5");
   strcpy(moves[7],"h7h5");
   strcpy(moves[8],"b8c6");
   strcpy(moves[9],"g8f6");

   printf("\n");   // winboard expects an empty line to initialize

   fflush(stdout);
   gets_s(user);   // engine expects "new"

   for(int k=0; k<10; k++) {
      
      fflush(stdout);
      gets_s(user);   // get move from winboard

      printf("move %s\n",moves[k]); // send move to winboard
               
   }
}

void main()
{
   char user[64];

   printf("falcon> ");
   fflush(stdout);
   gets_s(user);   // expecting "xboard"

   xboard();
}

When I load this engine onto winboard I play any move with white and black responds with f7f5, I play another move and black responds with Nc6 and then crashes with a message that "engine terminated unexpectedly".
Can anybody explain this? First black move should be a7a5 to begin with, followed by b7b5 and so on.
Thanks in advance...
gpapas123
 
Posts: 5
Joined: 07 Jul 2010, 21:41

Re: test on the UI failed

Postby H.G.Muller » 28 Sep 2017, 17:10

It seems you are completely in the dark as to what WinBoard sends to an engine, and the engine doesn't make much effort to figure it out either. Run WinBoard with the Additional option -debug , and it will create a winboard.debug file that (amongst other) contains all communication between engine and GUI. Then you can exactly see how this "deaf-man's conversation" gets out of phase through all the commands that WinBoard sends that are not moves.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: test on the UI failed

Postby gpapas123 » 04 Oct 2017, 12:31

Thanks for your reply H.G.Muller,

I did the -debug thing but it was in an older version, has anything changed recently?
Correct me if I am wrong, a possible beginning, when the engine plays black:

WINBOARD ENGINE
Starts Engine
> "xboard"
> "new"
> "e2e4" (user plays e4 on the board)
< "move a7a5"

etc. which is consistent with my program. I don't want to do any move calculation or thinking at this point,
I just want to feed these moves to winboard to check command flow. So I just accept anything from winboard
and I send the move a5.
gpapas123
 
Posts: 5
Joined: 07 Jul 2010, 21:41

Re: test on the UI failed

Postby gpapas123 » 04 Oct 2017, 20:36

Yes you're right, thanks...
Seems like many commands that were not necessary are necessary now.
I ran with the -debug option and saw all this mumbo jumbo that the engine has to receive and I am changing my code to do that.
gpapas123
 
Posts: 5
Joined: 07 Jul 2010, 21:41

Re: test on the UI failed

Postby H.G.Muller » 05 Oct 2017, 21:57

Well, it must have been a very old version. Tim Mann stopped working on WinBoard around 2001, and in his latest version (4.2.7) protocol v2 (which sends "protover 2" after "xboard") was already well established, I think.
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest