XBoard 4.9 hangs on receiving promotion choices

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

XBoard 4.9 hangs on receiving promotion choices

Post by Evert »

XBoard 4.9 (or rather, a recent checkout from winboard.nl with a few patches to make Xiangqi work properly) hangs if I send "choice" in response to "lift". The log file is rather unhelpful, all it contains is this:

Code: Select all

64079 <first : move b5a6
write FEN 50-move: 0 10 0
e0. p=-6
e1. p=-3
e2. p=-3
e3. p=-3
e4. p=-6
e5. p=-3
e6. p=-3
e7. p=-3
e8. p=-6
e9. p=-3
e10. p=-6
69851 >first : lift g7
69854 <first : highlight 5M1M/8/8/8/8/8/8/8
69854 <first : choice nbrq
GameEnds(29, xboard exit, 2)
74524 >first : result * {xboard exit}
74524 >first : force
74524 >first : ping 2
74524 >first : quit
The relevant position is [d]rn1qkbnr/p1ppppP1/bp6/7p/4P3/8/PPPP2PP/RNBQKBNR w KQkq - 1 6
(In case anyone wonders: I'm testing a random-mover mode)

All I can do after picking up the pawn is kill xboard (using ctrl-C in the terminal), it does not respond to key presses or mouse clicks. It looks like it's stuck in a loop somewhere...
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: XBoard 4.9 hangs on receiving promotion choices

Post by Evert »

I guess this issue is not fixed; is it worthwhile for me to add an option to disable sending "choice" in response to "lift"?
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard 4.9 hangs on receiving promotion choices

Post by hgm »

Sorry, I was a bit distracted by the ICGA Olympiad the past week. Can you try it with captital piece IDs, as the specs of the 'choice' command prescribe? XBoard probably gets stuck in a cyclic loop through the pieceToCharTable if it cannot find a match with the string in the 'choice' command.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: XBoard 4.9 hangs on receiving promotion choices

Post by Evert »

There's a specification for it?! :P
It's not listed on http://hgm.nubati.net/CECP.html or http://www.gnu.org/software/xboard/engine-intf.html
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard 4.9 hangs on receiving promotion choices

Post by hgm »

Sorry, I accidentally damaged your previous post, by hitting 'Edit' where I thought I was hitting 'Quote'. :oops:
There's a specification for it?! :P
It's not listed on http://hgm.nubati.net/CECP.html or http://www.gnu.org/software/xboard/engine-intf.html
The engine-intf.html in the source tar ball describes it. Apparently the one on the GNU website has not been updated yet to conform to the latest release.

And indeed, the first piece mentioned will be the default piece. Also notice the use of blue highlights to trigger promotion without choice.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: XBoard 4.9 hangs on receiving promotion choices

Post by Evert »

hgm wrote:Sorry, I accidentally damaged your previous post, by hitting 'Edit' where I thought I was hitting 'Quote'. :oops:
Moderator abuse! Bring out the pitchforks! Get the tar and feathers! I'm being oppressed!

Ahem.

Anyway, the point was, it works now.
And indeed, the first piece mentioned will be the default piece. Also notice the use of blue highlights to trigger promotion without choice.
I have the blue highlights.
I gather the rest of the order is arbitrary? I now send the pieces in order (from most valued to least valued), so I get Q by default. However, N is still second, although I send the string as QRBN... doesn't matter too much, as long as the first choice makes sense.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard 4.9 hangs on receiving promotion choices

Post by hgm »

Indeed, XBoard cycles through the pieces in pieceToCharTable order, usually starting at Queen, except for some variants that explicitly specify a different default. It always skips pieces for which no ID is defined. So it is no problem if the Queen does not participate. In Chess there is nothing after Q, so it immediately wraps to N.

The 'choice' command only alters this procedure by also skipping every piece not in the choice string, and starting at the first-mentioned piece.

(When the piece to promote is part of a Shogi-promotion pair, i.e. if it or its partner has a '+' defined as ID for it, a different procedure is used, which just alternates between the promoted and unpromoted version.)