What's wrong with this EPD?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Jouni
Posts: 3279
Joined: Wed Mar 08, 2006 8:15 pm

What's wrong with this EPD?

Post by Jouni »

Chessbase says illegal, but Arena accepts:

[D]Nb1QN3/1pp1PPp1/1rnn1p1P/1Pkr2B1/P1pRpK1p/2P1P2B/2qb2Pp/4R3 w - -

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

Re: What's wrong with this EPD?

Post by sje »

The full six field FEN is:
[D]Nb1QN3/1pp1PPp1/1rnn1p1P/1Pkr2B1/P1pRpK1p/2P1P2B/2qb2Pp/4R3 w - - 0 1

It is legal FEN.
User avatar
George Tsavdaris
Posts: 1627
Joined: Thu Mar 09, 2006 12:35 pm

Re: What's wrong with this EPD?

Post by George Tsavdaris »

sje wrote:The full six field FEN is:
[D]Nb1QN3/1pp1PPp1/1rnn1p1P/1Pkr2B1/P1pRpK1p/2P1P2B/2qb2Pp/4R3 w - - 0 1

It is legal FEN.
Actually that would be illegal too.
How can you reach this position in 1 move? :D

Replacing w - - 0 1 with w - - 0 100 for example i guess would make it legal(if there is a sequence of moves that reaches this position from the initial).
After his son's birth they've asked him:
"Is it a boy or girl?"
YES! He replied.....
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: What's wrong with this EPD?

Post by Dann Corbit »

White has all but one of his chessmen on the board.
How did the black pawns move to those locations.

As a retrograde position, it is not possible. It's pretty clever that an interface caught it.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: What's wrong with this EPD?

Post by hgm »

'Annoying' would describe it better than 'clever'! If it really refuses it for this reason, it is just needlessly restricting its usefulness to the user. Nothing worse than pedantic software...
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: What's wrong with this EPD?

Post by sje »

FEN describes all chess positions including those that cannot be reached from the initial array.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: What's wrong with this EPD?

Post by Evert »

Dann Corbit wrote:White has all but one of his chessmen on the board.
How did the black pawns move to those locations.
Same question about the white pawns on the 7th rank, actually.
Jouni
Posts: 3279
Joined: Wed Mar 08, 2006 8:15 pm

Re: What's wrong with this EPD?

Post by Jouni »

Stockfish 2 isn't doing anything in this position, a bug?

2011-03-20 20:04:12.666-->1:isready
2011-03-20 20:04:12.666<--1:readyok
2011-03-20 20:04:12.791-->1:position fen Nb1QN3/1pp1PPp1/1rnn1p1P/1Pkr2B1/P1pRpK1p/2P1P2B/2qb2Pp/4R3 w - - 0 1
2011-03-20 20:04:12.791-->1:go infinite
2011-03-20 20:04:12.807**Time for starting analysis:640
2011-03-20 20:04:14.304-->1:stop

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

Re: What's wrong with this EPD?

Post by sje »

Jouni wrote:Stockfish 2 isn't doing anything in this position, a bug?
Maybe not, depending on interpretation. Black's bishops are running on the same color squares but neither is the result of a promotion.

Then again, if a program thinks that a position is broken, then the program should note that fact in its output or at least refuse to accept the broken position.

Another subtle problem that can hang an unsuspecting program: triple check. This can't happen in any position from the initial array, but it can happen in a setup position. It's possible for a program's check evasion routine to say "if my king is attacked but if the number of attacks is not two then I assume the number is one". That would be okay for normal play, but not for a maliciously specified busted position.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: What's wrong with this EPD?

Post by Sven »

sje wrote:
Jouni wrote:Stockfish 2 isn't doing anything in this position, a bug?
Maybe not, depending on interpretation. Black's bishops are running on the same color squares but neither is the result of a promotion.

Then again, if a program thinks that a position is broken, then the program should note that fact in its output or at least refuse to accept the broken position.

Another subtle problem that can hang an unsuspecting program: triple check. This can't happen in any position from the initial array, but it can happen in a setup position. It's possible for a program's check evasion routine to say "if my king is attacked but if the number of attacks is not two then I assume the number is one". That would be okay for normal play, but not for a maliciously specified busted position.
I think it is acceptable if an engine rejects an FEN of a position that cannot be reached by any sequence of legal move from the initial position (possibly including all 960 initial positions of Chess 960 if you like). This implies that situations like "triple check", "two like bishops where none of them results from promotion", or "pawn structure would have required more captures than enemy pieces are missing" can be rejected.

I agree that the way how such a position is rejected should be like you mentioned, i.e. not crashing but either sending an appropriate output or refusing to play or analyze from that position.

An engine can make assumptions like the one you mentioned about the number of checks if it is strict enough in rejecting "illegal FENs". Here the term "illegal FEN" is not precise, of course, since it is not the FEN itself which is illegal (the PGN standard describes the format only) but the position described by the FEN is unreachable based on FIDE chess rules.

It is a separate topic whether engines should also support analysis (or even game playing) for such unreachable positions. I would not be surprised, however, if most of today's competetive engines stick to not supporting these since playing strength in standard games often has the main focus.

Sven