Winboard Protover 2 - QQ

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Matt Thomas

Winboard Protover 2 - QQ

Post by Matt Thomas »

Hello,

quick question, re: comms, Winboard to engine:

I understand:
1 start Winboard
2 Winboard starts engine exec
3 Winboard sends "xboard\n" to engine
4 Winboard sends "protover 2\n" to engine

In the docs I read that the engine must respond to the "xboard" command with "\n".

Question: does the engine send this response immediately upon receiving the "xboard" command, or does it wait to receive the "protover 2" command, then send the "\n" followed by the features ?

Thanks, matt
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Winboard Protover 2 - QQ

Post by bob »

Matt Thomas wrote:Hello,

quick question, re: comms, Winboard to engine:

I understand:
1 start Winboard
2 Winboard starts engine exec
3 Winboard sends "xboard\n" to engine
4 Winboard sends "protover 2\n" to engine

In the docs I read that the engine must respond to the "xboard" command with "\n".

Question: does the engine send this response immediately upon receiving the "xboard" command, or does it wait to receive the "protover 2" command, then send the "\n" followed by the features ?

Thanks, matt
You must be misreading something. sending "\n" to xboard does absolutely nothing. It is a required terminator for each thing you do send it of course... When you receive the "protover 2" string, you should start sending "feature" commands to tell it what parts of the protocol version 2 you are willing to use (xx=1) and which parts you do not want to deal with (xx=0).
MattieShoes
Posts: 718
Joined: Fri Mar 20, 2009 8:59 pm

Re: Winboard Protover 2 - QQ

Post by MattieShoes »

Matt Thomas wrote:Hello,

quick question, re: comms, Winboard to engine:

I understand:
1 start Winboard
2 Winboard starts engine exec
3 Winboard sends "xboard\n" to engine
4 Winboard sends "protover 2\n" to engine

In the docs I read that the engine must respond to the "xboard" command with "\n".

Question: does the engine send this response immediately upon receiving the "xboard" command, or does it wait to receive the "protover 2" command, then send the "\n" followed by the features ?

Thanks, matt
You don't have to send anything in response to the xboard command.

This may sound dumb, but better safe than sorry... You know \n is the newline code and not literally a backslash and n, right?
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Winboard Protover 2 - QQ

Post by Sven »

MattieShoes wrote:
Matt Thomas wrote:Hello,

quick question, re: comms, Winboard to engine:

I understand:
1 start Winboard
2 Winboard starts engine exec
3 Winboard sends "xboard\n" to engine
4 Winboard sends "protover 2\n" to engine

In the docs I read that the engine must respond to the "xboard" command with "\n".

Question: does the engine send this response immediately upon receiving the "xboard" command, or does it wait to receive the "protover 2" command, then send the "\n" followed by the features ?

Thanks, matt
You don't have to send anything in response to the xboard command.

This may sound dumb, but better safe than sorry... You know \n is the newline code and not literally a backslash and n, right?
Not quite correct, though.
Taken from Tim Mann's original engine interface description which is identical to H.G. Muller's document regarding this part:
xboard
This command will be sent once immediately after your engine process is started. You can use it to put your engine into "xboard mode" if that is needed. If your engine prints a prompt to ask for user input, you must turn off the prompt and output a newline when the "xboard" command comes in.
So the protocol document requires a "\n" as reaction to "xboard" from those engines who use a prompt (mainly in "console mode") to ask for user input.

Sven
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: Winboard Protover 2 - QQ

Post by Matthias Gemuh »

Sven Schüle wrote:
xboard
This command will be sent once immediately after your engine process is started. You can use it to put your engine into "xboard mode" if that is needed. If your engine prints a prompt to ask for user input, you must turn off the prompt and output a newline when the "xboard" command comes in.
So the protocol document requires a "\n" as reaction to "xboard" from those engines who use a prompt (mainly in "console mode") to ask for user input.

Sven
ChessGUI does not expect this weird "\n" after "xboard", and would ignore it (if sent).

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Winboard Protover 2 - QQ

Post by hgm »

Sven Schüle wrote: Not quite correct, though.
Taken from Tim Mann's original engine interface description which is identical to H.G. Muller's document regarding this part:
xboard
This command will be sent once immediately after your engine process is started. You can use it to put your engine into "xboard mode" if that is needed. If your engine prints a prompt to ask for user input, you must turn off the prompt and output a newline when the "xboard" command comes in.
So the protocol document requires a "\n" as reaction to "xboard" from those engines who use a prompt (mainly in "console mode") to ask for user input.
The mentioned '\n' is a kludge, to make WB forget an earlier prompt you printed. Suppose you printed "your move: " as a prompt. If, in response to "protover 2" you would now send "feature ..." immediately, WB would read a line "your move: feature ...". It would not recognize that as a feature command (nor as a move command). If you send the '\n' first, WB would read two lines, "your move: \n" and "feature ...". It would not recognize (and thus ignore) the first line, and then correctly recogniz the feature command.
Matt Thomas

Re: Winboard Protover 2 - QQ

Post by Matt Thomas »

MattieShoes wrote:
Matt Thomas wrote:Hello,

quick question, re: comms, Winboard to engine:

I understand:
1 start Winboard
2 Winboard starts engine exec
3 Winboard sends "xboard\n" to engine
4 Winboard sends "protover 2\n" to engine

In the docs I read that the engine must respond to the "xboard" command with "\n".

Question: does the engine send this response immediately upon receiving the "xboard" command, or does it wait to receive the "protover 2" command, then send the "\n" followed by the features ?

Thanks, matt
You don't have to send anything in response to the xboard command.

This may sound dumb, but better safe than sorry... You know \n is the newline code and not literally a backslash and n, right?
Yes, thanks.
Matt Thomas

Re: Winboard Protover 2 - QQ

Post by Matt Thomas »

bob wrote:
Matt Thomas wrote:Hello,

quick question, re: comms, Winboard to engine:

I understand:
1 start Winboard
2 Winboard starts engine exec
3 Winboard sends "xboard\n" to engine
4 Winboard sends "protover 2\n" to engine

In the docs I read that the engine must respond to the "xboard" command with "\n".

Question: does the engine send this response immediately upon receiving the "xboard" command, or does it wait to receive the "protover 2" command, then send the "\n" followed by the features ?

Thanks, matt
You must be misreading something. sending "\n" to xboard does absolutely nothing. It is a required terminator for each thing you do send it of course... When you receive the "protover 2" string, you should start sending "feature" commands to tell it what parts of the protocol version 2 you are willing to use (xx=1) and which parts you do not want to deal with (xx=0).
I understand the application of the newline now, only used when an engine provides a user prompt in console when started - my engine does not, so I will not need the "\n".

I was reading this from the Tim Mann docs:

xboard
This command will be sent once immediately after your engine process is started. You can use it to put your engine into "xboard mode" if that is needed. If your engine prints a prompt to ask for user input, you must turn off the prompt and output a newline when the "xboard" command comes in.

Thanks Professor Hyatt
MattieShoes
Posts: 718
Joined: Fri Mar 20, 2009 8:59 pm

Re: Winboard Protover 2 - QQ

Post by MattieShoes »

Doh, I never knew that. :-) my mistake.