Hello H.G.Muller : upgrading the protocol

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Hello H.G.Muller : upgrading the protocol

Post by bob »

Matthias Gemuh wrote:
hgm wrote:
bob wrote:Correct, but notice we are _not_ talking about winboard at the moment. This is another interface that uses the winboard protocol and missed this important nuance of offering/claiming a draw before making the move. If someone does this just like xboard currently does, all is well. Otherwise there are issues and a race condition that is ugly.
Competely false.

ChessGUI follows the protocol specs faithfully, in exactly the same way as current XBoard does. Crafty would also forfeit these games on XBoard or Winboard, for committing this protocol violtion that you so long have exploited. Except that the message appearing in the PGN would be more to the point: it would not say 0-1 {resign} but it would say something like 0-1 {False draw claim by Crafty}.

Thanks, HGM, for emphasizing this :D
I was already thinking "1/2-1/2 {3-fold repetition}" is a legitimate way of offering a draw and that I had misunderstood the protocol.
I will undo the "bugfix" I introduced in latest ChessGUI and correct only the misleading "resign" comment by ChessGUI.

Matthias.
Let's back this up. You should not parse "1/2-1/2". That is not an xboard command. The only way you can legally parse 1/2-1/2 is if it is appended to a "result" command. And Crafty does not send a "result" command to the GUI any longer.

There are simple rules in the engine-to-interface parsing process. You can't parse a move unless it follows "move". You can't parse comments like 1/2-1/2 unless it follows result. Etc. Crafty produces lots of output to the user, and almost all of it is outside of the xboard protocol.

So now I am no longer sure what we are talking about.

Crafty claims a draw by repetition by sending "offer draw" followed on the next line by "move xxx" where xxx is the move that produces the 3-fold repetition. I have no clue what HGM is rambling on about. If you are parsing 1/2-1/2, which is an informative "score" message sent to the operator, you are making a mistake. If you are only parsing it on a result command, you won't see that from Crafty, ever, in version 23.0 and beyond.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Hello H.G.Muller : upgrading the protocol

Post by bob »

krazyken wrote:But that just makes no sense, why change the rules? A false draw claim should be ignored and the game should continue.
Some think they should define the rules of chess to fit how they think they ought to be, not how they really are...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Hello H.G.Muller : upgrading the protocol

Post by bob »

hgm wrote:The vast majority of engines mean it when they send a game-termination command. Allowing an engine that is already dead to 'continue' the game is thus just a waste of valuable CPU time. It is bad enough when engines crash during a game without any warning. But when they explicitly say that they will not continue the game, it is overall better to take them seriously.

If they afterwards complain that they were perfectly prepared to continue... Well, just their bad luck. Then they shoud not have tolde the GUI that they were done. Just like they should not resign when they are winning, and then complain that the 'resign' message was meant only to spur on the opponent to resign.
Again, you keep saying "game termination command". And again, Crafty _never_ sends "result 1/2-1/2". Think you will ever grasp that? That is not what is being discussed here.

Feel free to look at 23.0 source and search for a "result 1/2-1/2". The only place you will see the word "result" and "1/2-1/2" is where I copy "1/2-1/2" to the variable "pgn_result" so that a "savegame" command will save a PGN file with the proper result attached.

Can we move on to what is actually happening, now, and stop discussing what you "think" is happening but is not?

No result is being sent. None. Nada. Just a simple draw offer that should turn into a claim after the move is parsed. Nothing more. Nothing less.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Hello H.G.Muller : upgrading the protocol

Post by bob »

Matthias Gemuh wrote:
krazyken wrote:But that just makes no sense, why change the rules? A false draw claim should be ignored and the game should continue.
HGM has already answered you.

"1/2-1/2 {bla bla bla}" means "I herewith exit this game because it has ended as can be seen on the board".

If the board says the game is not over, GUI cannot just assume that the engine is still able to continue. At that almost all engines have quit the game.

Matthias.
Sorry, but that is false. If I send "result 1/2-1/2" then I am claiming, to the gui, that the game is over. Crafty sends no such string. If I send 1/2-1/2 then you are obligated to ignore it as it is not a part of the xboard protocol.
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: Hello H.G.Muller : upgrading the protocol

Post by Matthias Gemuh »

krazyken wrote:CPU time isn't more valuable than the time I spend correcting results. A forfeit on time is a valid result, losing due to false draw claim is not a valid result.
Waiting for an engine that had (on its own free will) said "bye, here I go." just to see whether it didn't go, is not how a GUI should work.

Of course, it is possible to offer an option that breaks protocol by tolerating false end-of-game claims.

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: Hello H.G.Muller : upgrading the protocol

Post by Matthias Gemuh »

bob wrote:
Sorry, but that is false. If I send "result 1/2-1/2" then I am claiming, to the gui, that the game is over. Crafty sends no such string. If I send 1/2-1/2 then you are obligated to ignore it as it is not a part of the xboard protocol.

I now see where you misunderstand the protocol.

Code: Select all

RESULT {COMMENT}
    When your engine detects that the game has ended by rule, your engine must output a line of the form "RESULT {comment}" (without the quotes), where RESULT is a PGN result code (1-0, 0-1, or 1/2-1/2), and comment is the reason. Here "by rule" means that the game is definitely over because of what happened on the board. In normal chess, this includes checkmate, stalemate, triple repetition, the 50 move rule, or insufficient material; it does not include loss on time or the like. Examples:

      0-1 {Black mates}
      1-0 {White mates}
      1/2-1/2 {Draw by repetition}
      1/2-1/2 {Stalemate}

"RESULT" is used there as a general term for "0-1", or "1-0", or "1/2-1/2", as the examples show and all 3 terminate the game.

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

Re: Hello H.G.Muller : upgrading the protocol

Post by hgm »

WinBoard protocol spec wrote: RESULT {COMMENT}
When your engine detects that the game has ended by rule, your engine must output a line of the form "RESULT {comment}" (without the quotes), where RESULT is a PGN result code (1-0, 0-1, or 1/2-1/2), and comment is the reason. Here "by rule" means that the game is definitely over because of what happened on the board. In normal chess, this includes checkmate, stalemate, triple repetition, the 50 move rule, or insufficient material; it does not include loss on time or the like. Examples:
0-1 {Black mates}
1-0 {White mates}
1/2-1/2 {Draw by repetition}
1/2-1/2 {Stalemate}

xboard relays the result to the user, the ICS, the other engine in Two Machines mode, and the PGN save file as required. Note that "definitey over" above means that sending this command will be taken by WinBoard as an unconditional refusal of the engine to play on, which might cause you to forfeit if the game was in fact not over. This command should thus not be used to offer draws, accept draws, or make draw-by-rule claims that might not be valid (because it is not your move, and the opponent already moved without you knowing it yet). For offering and claiming draws, "offer draw" should be used.
(Note the green part was added by me, as explanation.)

Bob, you mix up the command that XBoard sends to the engines, to tell them the result (for learning), and the command that the engine sends to XBoard.

As Matthias says above, ChessGUI did not forfeit Crafty for sending offer draw (why the heck should it ever do that ever, on a draw offer???), but for sending 1/2-1/2). If you send offer draw + move, it is perfectly OK. But it is not what people claim this Crafty version sends.

I am not looking for any fight with you, but I can only conclude from this thread so far:
1) Your knowledge of WB protocol is not as large as your confidence
2) Others seem to know better what Crafty sends than you do...

I only came to this thread (after being invited in the title) to explain why a protocol extension is not needed. If you agree that offer draw + move does the trick, then everyone is happy. But stop talking nonsense about the protocol, and fix Crafty so that it prints what you intend it to print.
Last edited by hgm on Fri Apr 24, 2009 5:46 pm, edited 2 times in total.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Hello H.G.Muller : upgrading the protocol

Post by bob »

Matthias Gemuh wrote:
krazyken wrote:CPU time isn't more valuable than the time I spend correcting results. A forfeit on time is a valid result, losing due to false draw claim is not a valid result.
Waiting for an engine that had (on its own free will) said "bye, here I go." just to see whether it didn't go, is not how a GUI should work.

Of course, it is possible to offer an option that breaks protocol by tolerating false end-of-game claims.

Matthias.
Please show me where Crafty says "Bye, here I go".
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: Hello H.G.Muller : upgrading the protocol

Post by Matthias Gemuh »

bob wrote: No result is being sent. None. Nada. Just a simple draw offer that should turn into a claim after the move is parsed. Nothing more. Nothing less.

I hope you now see that you _are_ sending a result and that _before_ the game is over.

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Re: Hello H.G.Muller : upgrading the protocol

Post by Matthias Gemuh »

bob wrote: Please show me where Crafty says "Bye, here I go".

1/2-1/2 {...}
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de