Winboard: Resigning?

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Ras
Posts: 1081
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Winboard: Resigning?

Post by Ras » Tue Jun 27, 2017 4:21 pm

Hi,

right now, my engine transmits "resign" before doing the last move, which is as per https://www.gnu.org/software/xboard/engine-intf.html :
Note that many interfaces work more smoothly if you resign before you move.
The idea is that this allows GUIs to override resigns in case the user wants to play until mate.

However, it seems I'm running into problems with the next game. Here the debug log from Arena. For the next game, "move now" doesn't work:

Code: Select all

2017-06-27 17&#58;54&#58;08,541<--1&#58;resign
2017-06-27 17&#58;54&#58;08,541*1*black resigns detected... 
2017-06-27 17&#58;54&#58;08,559<--1&#58;move f7g7
2017-06-27 17&#58;54&#58;08,559*1*Found move&#58;Kf7-g7
2017-06-27 17&#58;54&#58;37,653**----------New game---2017-06-27 17&#58;54&#58;37,653 Di -------------
2017-06-27 17&#58;54&#58;37,653-->1&#58;st 10
2017-06-27 17&#58;54&#58;37,654-->1&#58;new
2017-06-27 17&#58;54&#58;37,654-->1&#58;st 10
2017-06-27 17&#58;54&#58;37,663-->1&#58;post
2017-06-27 17&#58;54&#58;37,665-->1&#58;ping 15
2017-06-27 17&#58;54&#58;37,733<--1&#58;pong 15
2017-06-27 17&#58;54&#58;41,912*1*
2017-06-27 17&#58;54&#58;41,912*1*
2017-06-27 17&#58;54&#58;41,913*1*Engine already calculating!
2017-06-27 17&#58;54&#58;41,913*1*
2017-06-27 17&#58;54&#58;41,913*1*
This is nonsense, the engine isn't calculating. It does not have ponder, and it reacts to ping, so it is ready to receive commands. If I give a "go" manually, it works:

Code: Select all

2017-06-27 17&#58;54&#58;49,698-->1&#58;go
2017-06-27 17&#58;54&#58;49,702<--1&#58;move g1f3
I might also have a similar issue with Winboard 4.8.0, but I'm not sure because there is no debug Window, and ctrl-alt-f12 doesn't seem to do anything useful.

Is the Winboard protocol note misleading in that there must not be any move after resign? Or is it a GUI problem?

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Winboard: Resigning?

Post by hgm » Tue Jun 27, 2017 5:10 pm

'resign' is a command that terminates the game. The GUI will likely save the PGN for the game, send a 'result' command to the opponent after putting it in 'force' mode, and possibly quit the engine process ad that of the opponent (if it is an -xreuse engine). There is no way to continue; sending a move would make the GUI think the engine moves out of turn and outside of any game. XBoard would igre such moves, but more aggressive treatment of such a misbehaving engine is conceivable.

I don't see anything misleading in the note. "don't eat before you kill yourself" doesn't imply or suggest you can eat after you killed yourself.

The problem with sending a move before resign is that the move is immediately relayed to the opponent, because the GUI cannot foresee 'resign' will follow. This will set the opponent thinking, and many (if not most) engies do not process any commands before they completed their thinking in the normal way. So the force / result / quit commands triggered by the resign could fall on deaf ears of the opponent, and if a new game of a match would be started against that same opponent immediately, and this opponent does not support ping, the move will be taken as the first move of the new game. And likely be illegal, leading to forfeit. (And if it isn't, lead to forfeit later, because the GUI thinks the move hs been played in the new game, and the engine thinks it isn't, but was played in the old game.

Ras
Posts: 1081
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: Winboard: Resigning?

Post by Ras » Tue Jun 27, 2017 5:36 pm

hgm wrote:There is no way to continue; sending a move would make the GUI think the engine moves out of turn and outside of any game.
Thanks for the explanation.

However, suggesting to keep a certain order of two events that are not even allowed to happen both is really misleading. Well, looks like I'll have to change the engine behaviour for the next version.

So I conclude it is not possible to decline a resignation and play until mate with a resigning Winboard engine?

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Winboard: Resigning?

Post by hgm » Tue Jun 27, 2017 6:39 pm

OK, I see now. It should have said: "Do not move before you resign". I will change it in the next XBoard release.

Ras
Posts: 1081
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: Winboard: Resigning?

Post by Ras » Tue Jun 27, 2017 6:55 pm

hgm wrote:OK, I see now. It should have said: "Do not move before you resign".
If the protocol spec does not allow moving at all when resigning because it's mutually exclusive, that should be stated clearly in the explanation for the resign command.

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Winboard: Resigning?

Post by hgm » Tue Jun 27, 2017 7:00 pm

Well, FIDE rules sort of imply that resigning terminates a game.

But I agree the current formulation is unclear.

Ras
Posts: 1081
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: Winboard: Resigning?

Post by Ras » Tue Jun 27, 2017 7:03 pm

Update on Arena 3.5.1: I deleted the move output after the resign, and I tried using the 1-0 format for resigning instead of "resign", but I still get the same behaviour. Arena somehow thinks that the engine is calculating when it isn't.

Any ideas whether the engine does anything dubious in the protocol output? Line ends are properly with \n, not with \r\n.

Or is Arena's protocol state machine just broken?

Code: Select all

2017-06-27 20&#58;57&#58;32,949*1*---------------------Starting engine 1 Ct800_v1.12_x64----------------------
2017-06-27 20&#58;57&#58;32,962*1*Configured Engine 1 Type&#58;   WB2
2017-06-27 20&#58;57&#58;32,962*1*Engine 1 dir&#58; C&#58;\Program Files &#40;x86&#41;\Arena\Engines\CT800
2017-06-27 20&#58;57&#58;32,962*1*Engine 1 commandline&#58; "C&#58;\Program Files &#40;x86&#41;\Arena\Engines\CT800\ct800_v1.12_x64.exe" 
2017-06-27 20&#58;57&#58;33,066*1*Engine 1 ProcessID&#58; 2440
2017-06-27 20&#58;57&#58;33,066*1*Engine 1 Prio&#58;32 ThreadPrio&#58;0
2017-06-27 20&#58;57&#58;33,066<--1&#58;# CT800 V1.12 64 bit
2017-06-27 20&#58;57&#58;33,066<--1&#58;# &#40;c&#41; 2017 by Rasmus Althoff
2017-06-27 20&#58;57&#58;33,067<--1&#58;# Free Software&#58; GPLv3+
2017-06-27 20&#58;57&#58;33,067-->1&#58;xboard
2017-06-27 20&#58;57&#58;33,067-->1&#58;protover 2
2017-06-27 20&#58;57&#58;33,137<--1&#58;# engine in x-board mode&#58; ready.
2017-06-27 20&#58;57&#58;33,137<--1&#58;feature myname="CT800 V1.12 64 bit" nps=0 sigint=0 draw=0 time=1 ping=1 done=1
2017-06-27 20&#58;57&#58;33,137-->1&#58;accepted nps
2017-06-27 20&#58;57&#58;33,137-->1&#58;accepted sigint
2017-06-27 20&#58;57&#58;33,137-->1&#58;accepted draw
2017-06-27 20&#58;57&#58;33,137-->1&#58;accepted time
2017-06-27 20&#58;57&#58;33,137-->1&#58;accepted ping
2017-06-27 20&#58;57&#58;33,137-->1&#58;accepted done
2017-06-27 20&#58;57&#58;33,379-->1&#58;new
2017-06-27 20&#58;57&#58;33,379-->1&#58;random
2017-06-27 20&#58;57&#58;33,379-->1&#58;sd 9999
2017-06-27 20&#58;57&#58;33,379-->1&#58;st 1
2017-06-27 20&#58;57&#58;33,379-->1&#58;post
2017-06-27 20&#58;57&#58;33,379-->1&#58;hard
2017-06-27 20&#58;57&#58;33,379-->1&#58;easy
2017-06-27 20&#58;57&#58;33,379-->1&#58;ping 5
2017-06-27 20&#58;57&#58;33,476<--1&#58;Error &#40;unknown command&#41;&#58; random
2017-06-27 20&#58;57&#58;33,476<--1&#58;Error &#40;unknown command&#41;&#58; hard
2017-06-27 20&#58;57&#58;33,480<--1&#58;Error &#40;unknown command&#41;&#58; easy
2017-06-27 20&#58;57&#58;33,484<--1&#58;pong 5
2017-06-27 20&#58;58&#58;27,520**----------New game---2017-06-27 20&#58;58&#58;27,520 Di -------------
2017-06-27 20&#58;58&#58;27,520-->1&#58;sd 9999
2017-06-27 20&#58;58&#58;27,520-->1&#58;st 1
2017-06-27 20&#58;58&#58;27,520-->1&#58;new
2017-06-27 20&#58;58&#58;27,520-->1&#58;sd 9999
2017-06-27 20&#58;58&#58;27,520-->1&#58;st 1
2017-06-27 20&#58;58&#58;27,538-->1&#58;post
2017-06-27 20&#58;58&#58;27,538-->1&#58;ping 10
2017-06-27 20&#58;58&#58;27,602<--1&#58;pong 10
2017-06-27 20&#58;58&#58;27,619-->1&#58;new
2017-06-27 20&#58;58&#58;27,619-->1&#58;sd 9999
2017-06-27 20&#58;58&#58;27,620-->1&#58;st 1
2017-06-27 20&#58;58&#58;27,624-->1&#58;post
2017-06-27 20&#58;58&#58;27,624-->1&#58;ping 14
2017-06-27 20&#58;58&#58;27,699<--1&#58;pong 14
2017-06-27 20&#58;58&#58;27,703-->1&#58;force
2017-06-27 20&#58;58&#58;27,703-->1&#58;edit
2017-06-27 20&#58;58&#58;27,909-->1&#58;#
2017-06-27 20&#58;58&#58;27,909-->1&#58;Kd4
2017-06-27 20&#58;58&#58;27,909-->1&#58;Ra6
2017-06-27 20&#58;58&#58;27,909-->1&#58;c
2017-06-27 20&#58;58&#58;27,909-->1&#58;Kd7
2017-06-27 20&#58;58&#58;27,909-->1&#58;.
2017-06-27 20&#58;58&#58;27,909-->1&#58;force
2017-06-27 20&#58;58&#58;30,583*1*Start calc, move no&#58; 1
2017-06-27 20&#58;58&#58;30,645-->1&#58;d4d5
2017-06-27 20&#58;58&#58;30,645-->1&#58;ping 18
2017-06-27 20&#58;58&#58;30,649<--1&#58;pong 18
2017-06-27 20&#58;58&#58;30,653-->1&#58;ping 19
2017-06-27 20&#58;58&#58;30,657<--1&#58;pong 19
2017-06-27 20&#58;58&#58;30,660-->1&#58;black
2017-06-27 20&#58;58&#58;30,660-->1&#58;go
2017-06-27 20&#58;58&#58;30,874<--1&#58;10 -640 21 402478 d7e7 a6h6 e7f7 h6e6 f7f8 d5d6 f8f7 d6d7 f7g7 e6e1 
2017-06-27 20&#58;58&#58;31,035<--1&#58;11 -641 37 801117 d7e7 a6h6 e7f7 h6e6 f7f8 d5d6 f8f7 d6e5 f7g7 e6f6 g7h7 
2017-06-27 20&#58;58&#58;31,325<--1&#58;12 -648 66 1540093 d7e7 a6h6 e7f7 d5e5 f7e7 h6h7 e7d8 e5e6 d8c8 e6d6 c8b8 d6d7 
2017-06-27 20&#58;58&#58;31,810<--1&#58;move d7e7
2017-06-27 20&#58;58&#58;31,810*1*Found move&#58;Kd7-e7
2017-06-27 20&#58;58&#58;34,189*1*Start calc, move no&#58; 3
2017-06-27 20&#58;58&#58;34,249-->1&#58;a6b6
2017-06-27 20&#58;58&#58;34,794<--1&#58;12 -651 54 1206157 e7f7 b6e6 f7g7 d5e5 g7f7 e5f5 f7g7 e6f6 g7h8 f5g6 h8g8 f6f1 
2017-06-27 20&#58;58&#58;35,399<--1&#58;move e7f7
2017-06-27 20&#58;58&#58;35,399*1*Found move&#58;Ke7-f7
2017-06-27 20&#58;58&#58;37,249*1*Start calc, move no&#58; 5
2017-06-27 20&#58;58&#58;37,307-->1&#58;d5e5
2017-06-27 20&#58;58&#58;37,459<--1&#58;11 -651 15 253423 f7e7 b6b7 e7d8 e5d6 d8e8 b7a7 e8f8 d6e6 f8g8 a7f7 g8h8 
2017-06-27 20&#58;58&#58;37,744<--1&#58;12 -659 43 958959 f7e7 b6b7 e7d8 e5d6 d8e8 b7a7 e8f8 d6e6 f8g8 e6f6 g8h8 f6f7 
2017-06-27 20&#58;58&#58;38,168<--1&#58;13 -9988 86 2016758 f7e7 b6b7 e7d8 e5d6 d8e8 d6e6 e8d8 b7f7 d8c8 e6d6 c8b8 d6c6 
2017-06-27 20&#58;58&#58;38,173<--1&#58;1-0 &#123;Black resigns&#125;
2017-06-27 20&#58;58&#58;38,173*1*black resigns detected... 
2017-06-27 20&#58;58&#58;44,459**----------New game---2017-06-27 20&#58;58&#58;44,459 Di -------------
2017-06-27 20&#58;58&#58;44,459-->1&#58;sd 9999
2017-06-27 20&#58;58&#58;44,459-->1&#58;st 1
2017-06-27 20&#58;58&#58;44,459-->1&#58;new
2017-06-27 20&#58;58&#58;44,459-->1&#58;sd 9999
2017-06-27 20&#58;58&#58;44,459-->1&#58;st 1
2017-06-27 20&#58;58&#58;44,479-->1&#58;post
2017-06-27 20&#58;58&#58;44,479-->1&#58;ping 22
2017-06-27 20&#58;58&#58;44,539<--1&#58;pong 22
2017-06-27 20&#58;58&#58;48,003*1*
2017-06-27 20&#58;58&#58;48,003*1*
2017-06-27 20&#58;58&#58;48,003*1*Engine already calculating!
2017-06-27 20&#58;58&#58;48,003*1*
2017-06-27 20&#58;58&#58;48,003*1*

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Winboard: Resigning?

Post by hgm » Tue Jun 27, 2017 8:15 pm

Well, from what I have heard, you cannot expect Arena to work correctly. It doesn't seem the engine is doing anything wrong.

Ras
Posts: 1081
Joined: Tue Aug 30, 2016 6:19 pm
Contact:

Re: Winboard: Resigning?

Post by Ras » Wed Jun 28, 2017 3:21 pm

hgm wrote:Well, from what I have heard, you cannot expect Arena to work correctly.
Yep, it is quirky, but I understand why it's so popular, despite some bugs. Chess GUI standards are so low that not being a total usability meltdown is already a major feature.
It doesn't seem the engine is doing anything wrong.
That's relieving, thanks.

Post Reply