Hello H.G.Muller : upgrading the protocol

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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:
Matthias Gemuh wrote:
krazyken wrote: How does this apply to the case of a 3-fold repetition? The game is not over until one of the players claims it is over, and the claim is verified by the arbiter.
According to the WB protocol, a 3-fold-rep ends the game.

Matthias.
Only if the engine claims it.

We have repetitions which can make a game really long, if there are pawns to push after every 49 moves.
ChessGUI terminates the game at first 3-fold-rep.

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
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:
bob wrote: Please show me where Crafty says "Bye, here I go".

1/2-1/2 {...}
Why do you conclude that. You play a human in a game, you reach a position you believe is a repetition, because you failed to notice that one piece was on a different square on what you called the first occurrence. You say "I claim a draw". Do you then walk away and go eat? Or do you wait for the TD, who says "this is not a draw, continue the game..."

I do the latter. Start crafty in console mode, and let it claim a draw by repetition, and see if it "packs up its bags and goes home" or if it will continue to play if you so choose. Hint: the latter.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

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

Post by michiguel »

Matthias Gemuh wrote:
krazyken wrote:
Matthias Gemuh wrote:
krazyken wrote: How does this apply to the case of a 3-fold repetition? The game is not over until one of the players claims it is over, and the claim is verified by the arbiter.
According to the WB protocol, a 3-fold-rep ends the game.

Matthias.
Only if the engine claims it.

We have repetitions which can make a game really long, if there are pawns to push after every 49 moves.
ChessGUI terminates the game at first 3-fold-rep.

Matthias.
Have you considered that a human could be playing against an engine? Let the human figure it out!

Are you aware that your GUI now is not winboard compliant nor FIDE?
Are you ok with that? If the answer is yes, when are you going to drop en passant support? :-)
It is pretty annoying :-)

Miguel
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:
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.
I send it at the _only_ point where I can safely send it. Again, with this position:

[D] 7k/8/8/1q6/6Q1/8/8/K7 w - - 0 1

You (black) have played 50 moves with no pawn push or capture. I have played 49 and it is my move. By FIDE rules, _any_ move I play that is not a pawn push (no pawns here) or a capture (no captures possible) leads to a position I can claim as a draw. I call the TD over and I say I am going to play the move Qh7+ and claim that is a draw by 50 move rule." He looks at the scoresheets, and agrees, and the game ends.

With your GUI, I first send the Qh7+, and then the draw claim (1/2-1/2). But before you have a chance to read my second line, you get an instant response from my opponent since he has only one legal move, and he plays Kxg7 and now this is not a draw. When you read my draw claim, you say "invalid" and cause me to lose. Here I am going to lose anyway, but this was a dead drawn game, by FIDE rule. Tell me how to fix that in your GUI and I'll do so. The only solution so far, has been to send the draw claim _first_ followed by the move. And if the GUI has any intelligence, it can figure out that the claim is for the position after the move (which is valid BTW) since it is not valid for the position _before_ the move.

Tell me how to fix this with your code.

Note also that I am allowed to claim a draw without moving at all, if the position meets the rule requirements. So a claim can legally come before or after the move, but while it is still my turn (according to FIDE rule). But I have no way to "retain the right to move" after I play a move with xboard protocol. Because announcing the move effectively ends my turn to play, unlike in human events.

How do I make this work in all cases with your code? I do not believe it is possible, as your code exists...
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 »

michiguel wrote:
Matthias Gemuh wrote:
bob wrote:
Crafty _always_ sends the 1/2-1/2 _after_ it makes a move.

No !

The reason Crafty forfeited in the game that started this discussion is that it sent the 1/2-1/2 while GUI was waiting for a move
I wonder whether the sequence was

Code: Select all

crafty --> offer draw
                          GUI gets "offer draw" from Crafty
crafty --> move Rh8
                          GUI gets "move Rh8" from Crafty
                                 (here GUI should declare a 
                                   draw with the new behavior 
                                   of offer draw)
                          GUI gets "move Kb7" from opponent faster 
                                        than next command from Crafty
crafty --> 1/2-1/2
                          GUI sees that it is not a draw anymore.

Here is all that came from Crafty, no more, no less.
Graham also may still have the debug file.

Code: Select all

Eng1 &#40;Crafty 23.0 32-bit&#41; <- 15      1       9 203837  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 16      1       9 203838  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 16      1      18 380236  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 17      1      18 380237  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 17      1      40 768760  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 18      1      40 768761  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 18      1      87 1625444  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 19      1      87 1625445  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 19      1     203 3716817  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 20      1     203 3716818  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 20      1     437 7781865  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 21      1     437 7781866  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 21      1     935 16387909  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 22      1     935 16387910  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 22      1    2976 50514331  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 23      1    2976 50514332  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 1/2-1/2 &#123;Drawn by 3-fold repetition&#125;

My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
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:Just to highlight redundantly what all this talk is about:


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

Therefore no move is to be expected after "1-0" {...}", or "0-1 {...}", or "1/2-1/2 {...}".

Matthias.
And _that_ is a serious problem. I hope you can now see why. Because it can't possibly work like that due to the example I have given more than once now.
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:
bob wrote:
OK, this is my mistake. I originally implemented the "result" command in xboard. And I still use that original version. I had not noticed that the "result" prefix I had added was not in the code released by Tim. In this regard, ending a game when an engine says 1/2-1/2 is a wrong decision. I had this discussion with HGM a while back and I believe that this "result" parsing should be removed. Should I really be able to end a game on the spot? Or should that be the GUI's response since it sits between the two engines that are playing? I can't send 1/2-1/2 after the move I play, because by the time you see it, you may well have received the move from my opponent first, and now the draw claim is no longer valid.
It is your turn to play, so GUI cannot process any move from opponent till you send your move or say you are quitting.
Please pay attention. One more time:

I need to make a move _before_ I can claim a repetition. Once I make the move, I can't prevent you from receiving that move, sending it to my opponent, and getting a move back from him, before I can get the draw claim to you. By now it is too late to make the claim.

\

ChessGUI eliminates the race situation, by _automatically_ checking for ending of game after your move. Any "1-0", etc. coming in from you after your move is obselete and just discarded. ChessGUI does not depend on a result from you to tell opponent that your move ended the game.
Then why on earth do you pay attention to a claim anywhere in the game? I have this as an option in my referee program as I have played against programs that do not implement the 50 move rule at all, or incorrectly and I want the game to end. But if you ignore it _after_ my move, why would you cause it to produce a loss _before_ my move??? That is beyond illogical.


The "result" command in the WB protocol should be dropped.
ChessGUI uses it only to penalize engines that use it to claim something wrongly.

If ChessGUI would want to use the command fully and without permitting a race, it would do the following:

- relay your move immediately to opponent, if GUI saw no end of game
- if GUI saw end of game after your move, your clock will continue ticking, while GUI waits just to see whether you will send a result. This would be just to find out whether you know when the game ends, and totally irrelevant for informing your opponent.

Matthias.
Lousy solution. I then lose on time while you are waiting. There are too many holes. I have already suggested ignoring the claims and assume that if a program repeats for the 3rd time, or meets the 50-move rule criterion, that the game is simply ended with that result. But not the loss you are currently doing, which makes no sense at all IMHO.

BTW, I don't know your programming background, but we are in a "parallel world" here since there are two programs sending info at the same time. You are making a classic beginner's mistake when you start talking about "I will wait for a bit". In parallel programming you _NEVER_ base anything on some amount of time elapsing. You base things on events getting properly detected or posted. That's where this problem is coming from. It seems simple to me, but I've been doing parallel stuff for 30+ years now and it is second nature. Forget the "time" word. It leads to massive trouble.
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 »

michiguel wrote:
Are you aware that your GUI now is not winboard compliant nor FIDE?
Are you ok with that? If the answer is yes, when are you going to drop en passant support? :-)
It is pretty annoying :-)

Miguel

Castling will soon be dropped also. It too is pretty annoying.

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
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: How does this apply to the case of a 3-fold repetition? The game is not over until one of the players claims it is over, and the claim is verified by the arbiter.
According to the WB protocol, a 3-fold-rep ends the game.

Matthias.
Not that I am aware of. No "draw" is forced except for stalemate and insufficient material. Or are we voilating yet another FIDE rule of chess here?
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:
bob wrote:
Crafty _always_ sends the 1/2-1/2 _after_ it makes a move.

No !

The reason Crafty forfeited in the game that started this discussion is that it sent the 1/2-1/2 while GUI was waiting for a move


Code: Select all

Eng1 &#40;Crafty 23.0 32-bit&#41; <- 21      1     437 7781866  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 21      1     935 16387909  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 22      1     935 16387910  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 22      1    2976 50514331  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 23      1    2976 50514332  72. Kf1
Eng1 &#40;Crafty 23.0 32-bit&#41; <- 1/2-1/2 &#123;Drawn by 3-fold repetition&#125;


Now in WB_EndOfGameClaim&#40;) at Time0000000939539828

Now in EndTheGame&#40;) at Time0000000939539828

0-1 &#123; Game Nr. 1 &#58; Crafty 23.0 32-bit resigns against ProDeo 1.6 
 GameDuration = 02&#58;15&#58;14, Finalposition 8/P7/5pk1/6pp/4P1nP/8/5KN1/6Qq w - - 11 72 &#125;
.

You are correct. That is necessary because of the race condition mentioned... My error.