Excuses for Wishy Washy FEN/EPD/PGN implementation

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

chrisw
Posts: 4319
Joined: Tue Apr 03, 2012 4:28 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by chrisw »

well, now there's no excuses. Verification code, C, all stand-alone to be found here, free to use.

https://github.com/ChrisWhittington/Che ... /README.md

Should work, fixes bad EPDs or returns a NULL if not.
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by Fulvio »

Have you take into account that the castling flags can also generate different FENs that refer to the same position?
r1b1k1nr/pp1n1ppp/2pb4/3p4/3PpPPq/2N1P2P/PPP3B1/R1BQK1NR w KQkq -
r1b1k1nr/pp1n1ppp/2pb4/3p4/3PpPPq/2N1P2P/PPP3B1/R1BQK1NR w Kkq -
r1b1k1nr/pp1n1ppp/2pb4/3p4/3PpPPq/2N1P2P/PPP3B1/R1BQK1NR w Qkq -
r1b1k1nr/pp1n1ppp/2pb4/3p4/3PpPPq/2N1P2P/PPP3B1/R1BQK1NR w kq -
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by Dann Corbit »

Castle flags can be bugs (e.g. castle flag set when there are no castle moves possible). I have a program to detect and correct this defect.
However, different castle states that are valid mean the positions really are different (IOW, different moves are possible as a function of the flags).

It is not uncommon to find in the wild a position with no rooks and with castle flags KQkq
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
chrisw
Posts: 4319
Joined: Tue Apr 03, 2012 4:28 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by chrisw »

Dann Corbit wrote: Thu Apr 16, 2020 11:36 pm Castle flags can be bugs (e.g. castle flag set when there are no castle moves possible). I have a program to detect and correct this defect.
However, different castle states that are valid mean the positions really are different (IOW, different moves are possible as a function of the flags).

It is not uncommon to find in the wild a position with no rooks and with castle flags KQkq
That's all taken care of in the source release. Now you just have to persuade all engine programmers to use it (or their own or whatever) .
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by Fulvio »

Dann Corbit wrote: Thu Apr 16, 2020 11:36 pm However, different castle states that are valid mean the positions really are different (IOW, different moves are possible as a function of the flags).
Nope.
Didn't I just posted 4 different valid FENs that have exactly the same possible moves?
chrisw
Posts: 4319
Joined: Tue Apr 03, 2012 4:28 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by chrisw »

Fulvio wrote: Fri Apr 17, 2020 12:17 am
Dann Corbit wrote: Thu Apr 16, 2020 11:36 pm However, different castle states that are valid mean the positions really are different (IOW, different moves are possible as a function of the flags).
Nope.
Didn't I just posted 4 different valid FENs that have exactly the same possible moves?
So what? They may have exactly the same possible moves because they block the R from moving or whatever, but their descendants will be different because of differing castle status flags still holding true. The FEN position data may be the same, but the positions are not.
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by Fulvio »

chrisw wrote: Fri Apr 17, 2020 12:21 am So what? They may have exactly the same possible moves because they block the R from moving or whatever, but their descendants will be different because of differing castle status flags still holding true. The FEN position data may be the same, but the positions are not.
[d]r1b1k1nr/pp1n1ppp/2pb4/3p4/3PpPPq/2N1P2P/PPP3B1/R1BQK1NR w KQkq -
Did you at least read my message before replying?
Please post an example of this immaginary different descendants.
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by Dann Corbit »

His point is that white has to move his king, so white will lose the white castle rights.
I consider this as the same category as a true e.p. pawn that cannot capture because it is pinned,
It would be nice to strip that e.p. flag (and I even have a tool to do it) but I can live with those.

I don't encounter many of those types of positions, but bad e.p. pawns are in the millions in data that I have collected,
I have a cleansing tool I run EPD through before I analyze it.
If I had a tool to remove spurious castle flags, I would use that too, but that one does not concern me because of the rarity of those positions,
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by Dann Corbit »

Let's consider this position: [d]r1b1k1nr/pp1n1ppp/2pb4/3p4/3PpPPq/2N1P2P/PPP3B1/R1BQK1NR w KQkq -

In order for the K or the Q to be stripped, one of the rooks would have had to have moved. Looking at this position, how often do you think it would have happened in a real game?

Also, it is necessary that the king is in check and can neither capture nor interpose a chessman.

It is a very interesting thing that I have never thought about before, so thank you for bringing it up.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
chrisw
Posts: 4319
Joined: Tue Apr 03, 2012 4:28 pm

Re: Excuses for Wishy Washy FEN/EPD/PGN implementation

Post by chrisw »

Dann Corbit wrote: Fri Apr 17, 2020 12:43 am His point is that white has to move his king, so white will lose the white castle rights.
Ah, yes, I see the idea now. Interesting, one learns something new every day, but of what practical import is this? Some different FENS (by castling rights) all morph into the same thing. And?

I consider this as the same category as a true e.p. pawn that cannot capture because it is pinned,
Well, as far as an engine is concerned, the pawn can pseudo-legal capture, and like all pseudo-legals, that gets tested as if arises and checked off.

It would be nice to strip that e.p. flag (and I even have a tool to do it) but I can live with those.
to check that stuff off at EPD verification time would be massive overkill, way too complex and asking for bugs.

I don't encounter many of those types of positions, but bad e.p. pawns are in the millions in data that I have collected,
I have a cleansing tool I run EPD through before I analyze it.
If I had a tool to remove spurious castle flags, I would use that too, but that one does not concern me because of the rarity of those positions,