XBoard problem: bad illegal move ruling

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

XBoard problem: bad illegal move ruling

Post by Evert »

In a set-up variant (in particular, Sittuyin) where all pieces start off in holdings, XBoard refuses any first move by black that isn't a king drop. White can do whatever he likes, but unless black drops his king for the first move, XBoard responds with an "illegal move" claim - even if legality testing is off.
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard problem: bad illegal move ruling

Post by hgm »

I can imagine why the checktest of XBoard would equate having no King after your move to stepping into check. (Atomic...) It is strange that it pays attention to this when legality testing is off, though.

Did you have to define any pieces with 'piece' commands in Sittuyin? I guess this effectively switches legality testing on again.

The best solution is probably to adopt the rule that if you have no King before the move, it is OK if you don't have one after it. That should be easy, as XBoard's GenLegal does call CheckTest for the current position, to know if it should attempt generating castlings. And I think Checktest already returns a different code for having no King as for getting it captured.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: XBoard problem: bad illegal move ruling

Post by Evert »

hgm wrote:I can imagine why the checktest of XBoard would equate having no King after your move to stepping into check. (Atomic...) It is strange that it pays attention to this when legality testing is off, though.
I found it even more peculiar that it only seems to do this for black...
Did you have to define any pieces with 'piece' commands in Sittuyin? I guess this effectively switches legality testing on again.
Have to? Probably not - it uses the same piece set as Makruk, with different promotion rules. Because I implemented it as a set-up variant (rather than a shuffle-variant) I derived it from "bughouse" to prevent captured pieces from going into holdings (where a user may think he can drop them), and I think the Silver General is normally used for a non-royal King (Man). So I guess it's needed for that. Either way, Sjaak sends piece commands regardless of whether it needs to or not, because it doesn't know when it needs to and when it doesn't.

However, it has an option to disable sending "piece" commands, and disabling them does indeed cure the problem.
The best solution is probably to adopt the rule that if you have no King before the move, it is OK if you don't have one after it. That should be easy, as XBoard's GenLegal does call CheckTest for the current position, to know if it should attempt generating castlings. And I think Checktest already returns a different code for having no King as for getting it captured.
Sounds reasonable!