Page 1 of 1

test on the UI failed

PostPosted: 26 Sep 2017, 12:14
by gpapas123
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...

Re: test on the UI failed

PostPosted: 28 Sep 2017, 17:10
by H.G.Muller
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.

Re: test on the UI failed

PostPosted: 04 Oct 2017, 12:31
by gpapas123
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.

Re: test on the UI failed

PostPosted: 04 Oct 2017, 20:36
by gpapas123
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.

Re: test on the UI failed

PostPosted: 05 Oct 2017, 21:57
by H.G.Muller
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.