FEN string

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Seven out of 100,000 checkmates

Post by michiguel »

marcelk wrote:As said, bogus castling flags are far more common (Qxd1+ ...) How about considering to take them out as well? There are positions where this is hard to determine, such as the one below

[D]4k3/8/8/8/8/8/7p/4KB1R w K -

But a 1 ply consideration should take care of all the practical cases.
I think it is not compatible with FIDE rules.

Miguel
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Seven out of 100,000 checkmates

Post by sje »

I wouldn't recommend an operation that can't be done in constant time given that it might need to be performed on each and every move execution during a search.

Also, if some (probably) superfluous castling flags were reset, what about clearing squares of trapped pieces that will (probably) never get a chance to move? There is no benefit to any of this while there is a benefit to killing off bogus en passant targets, something that can be done deterministically taken constant time.
User avatar
marcelk
Posts: 348
Joined: Sat Feb 27, 2010 12:21 am

Re: Seven out of 100,000 checkmates

Post by marcelk »

The reason would be compatibility with the FIDE rule that determines
when two positions are considered equal.
Positions as in (a) and (b) are considered the same, if the same player
has the move, pieces of the same kind and colour occupy the same
squares, and the possible moves of all the pieces of both players are the
same.
My old 1997 paper copy of the rules adds a clause regarding castling
rights. The current online version on the FIDE website excludes this
phrase. The current version does throw in a
When a king or a rook is forced to move, it will lose its castling rights,
if any, only after it is moved.
This phrase seems out of place because it doesn't say that those castling
rights are part of the equality test in case castling is not possible. It
suggests it, but it doesn't state it. ("right" is not the same as "possibility").

Therefore, in my example, I say the castling move is not possible
anymore and thus the positions with and without the flag are equal
by FIDE's current definition.

It would be nice if FEN equality is equivalent with FIDE equality. (One way
of course is for FIDE to make its definition more precise).
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Seven out of 100,000 checkmates

Post by sje »

It has been some years, but the last time I checked FIDE couldn't get the complete file/rank move disambiguation rules correct. Also, chess books being published with the FIDE imprimatur depart from the FIDE chess move algebraic standard at times.

Depending on FIDE, like depending on the USCF, is more suited for lawyers than it is for engineers.