What's wrong with this EPD?

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: What's wrong with this EPD?

Post by michiguel »

hgm wrote:'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...
There is something worse: software that crashes. An engine should reject what it cannot handle, but not more than that. For instance, if an engine has a data structure that admits up to 16 pieces per side and no more, it should reject positions with 17 pieces, otherwise, it will sooner or later crash. On the other hand, there is no reason to reject a position based on a clever retrograde analysis. Most likely, the internal data structures could handle that position. I agree with you in the latter case. However, in many cases, it is not pedantry, it is an acknowledgment of the limitations.

Miguel
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: What's wrong with this EPD?

Post by mar »

StockFish seems to search ~77M nodes at depth 1 in that position. After that it works fine.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

What we need is...

Post by sje »

What we need is a test suite of FEN records each with data that could not occur as a result of normal play. Each record could be documented as to why the record is bogus, and any decent chess program should reject at least those positions that might cause that program to hang.

Those with access to many different programs could run the suite so we could see which programs need revision to avoid crashing.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: What's wrong with this EPD?

Post by michiguel »

mar wrote:StockFish seems to search ~77M nodes at depth 1 in that position. After that it works fine.
Gaviota seems to be ok here (sees mate in 2.5 seconds).
Is this a mate in 12?

Miguel

Code: Select all

      4546   1:      0.0    +3.86  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
      5755   2       0.0      :-)  1.Rxd5+
     11213   2:      0.0    +5.07  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe1 9.e8=Q h1=Q
                                   10.Nxb8
     11481   3       0.0      :-)  1.Rxd5+
     11841   3       0.0      :-)  1.Rxd5+
     13309   3       0.0      :-)  1.Rxd5+
     17533   3:      0.0   +12.00  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Kxe3 Qxc3+
                                   10.Kf2
     28216   4       0.1      :-(  
     30910   4       0.1      :-)  1.Rxd5+
     36858   4:      0.1   +12.53  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Rxe3 Qf2+
                                   10.Kg4
     38212   5       0.1      :-)  1.Rxd5+
     79971   5:      0.2   +16.79  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Rxe3 Qf2+
                                   10.Kg4 Qxf8 11.exf8=Q h1=Q 12.bxc6
    201017   6       0.5      :-(  
    203624   6:      0.5   +16.79  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Rxe3 Qf2+
                                   10.Kg4 Qxf8 11.exf8=Q h1=Q 12.bxc6
    206816   7       0.5      :-)  1.Rxd5+
   1924826   7:      2.5  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
   6154537   8       6.1  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
   8468613   8:      8.0  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
  26624058   9      17.5  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
  39706808   9:     24.4  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
 117132659  10      55.2  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
 178180289  10:     80.1  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
 488649340  11     184.9  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: What's wrong with this EPD?

Post by bob »

Jouni wrote:Chessbase says illegal, but Arena accepts:

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

Jouni
I tried it and got mate in 12 with Crafty.

16-> 25.55 Mat12 1. Rxd5+ Kxd5 2. Nexc7+ Bxc7 3. Nxc7+
Kc5 4. Qxd6+ Kxd6 5. e8=N+ Ke7 6. f8=Q+
Kxf8 7. hxg7+ Ke7 8. Bxf6+ Kf7 9. Be6+
Kg6 10. g8=Q+ Kh6 11. Bg7+ Kh5 12.
Bf7# (s=4)

didn't let it search longer to see if there is a shorter one. This on my laptop, one cpu...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: What we need is...

Post by bob »

sje wrote:What we need is a test suite of FEN records each with data that could not occur as a result of normal play. Each record could be documented as to why the record is bogus, and any decent chess program should reject at least those positions that might cause that program to hang.

Those with access to many different programs could run the suite so we could see which programs need revision to avoid crashing.
I do the obvious things only.

1. white can never have more than 16 total pieces counting king, pawns and pieces (same for black for each of the following also). Never more nor less than 1 king, obviously.

2. white can never have more than 10 knights, bishops or rooks.

3. white can never have more than 9 queens.

4. No pawns on bogus squares (1st or 8th rank)

5. castling status is checked against position of rooks and king. EP status is quietly zeroed if an ep capture is not actually possible (as when the ep target is set after a double pawn push but opponent has no pawns on adjacent file that can do the ep capture.

I don't check less obvious things. Pawns on a2-a5 and b2-b5, positions where side not on move has no possible move that could be unmade and then made to reach this position, etc. I didn't figure those were worthwhile nor doable. I'm not going to spend days doing a backward search to see if I can get back to the starting position legally...
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: What we need is...

Post by sje »

FEN input checking in the new Chess In Lisp toolkit:

1) For each color:

Man count <= 16 (actually, twice the number of files).
King count == 1.
Pawn count <= 8 (actually, the number of files).

2) The number of missing pawns for each color is calculated and for each QRBN of that color, any extra men counts are subtracted from the missing pawn count; if the count goes negative, the position is broken.

3) For each color:
No pawns on the first rank.
No pawns on the eighth rank.

4) For each color:
For each flank with available castling, the king and rook must be on their home squares, else broken.

5) For a non-nil epsq (en passant target square):
The epsq must be on the third or sixth rank, else broken.
The evil color (side not on the move) must correspond to the epsq rank, else broken.
The epsq square itself must be vacant, else broken.
There has to be an evil pawn one square ahead of the epsq; else broken.
There has to be a vacant square one square behind the epsq; else broken.
The halfmove counter must be zero, else broken.
If there isn't at least one good pawn adjacent to the just moved evil pawn, then the epsq is silently erased.
If there is at least one good pawn adjacent but there is no legal ep capture, then the epsq is silently erased.

6) The halfmove counter can't too large for the fullmove number, else broken.

7) The the fullmove number must be >= 1, else broken.

8) The evil color must not be in check.

9) The good color king must not have more than two incoming attacks.
mar
Posts: 2559
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: What's wrong with this EPD?

Post by mar »

michiguel wrote:
mar wrote:StockFish seems to search ~77M nodes at depth 1 in that position. After that it works fine.
Gaviota seems to be ok here (sees mate in 2.5 seconds).
Is this a mate in 12?

Miguel

Code: Select all

      4546   1&#58;      0.0    +3.86  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
      5755   2       0.0      &#58;-)  1.Rxd5+
     11213   2&#58;      0.0    +5.07  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe1 9.e8=Q h1=Q
                                   10.Nxb8
     11481   3       0.0      &#58;-)  1.Rxd5+
     11841   3       0.0      &#58;-)  1.Rxd5+
     13309   3       0.0      &#58;-)  1.Rxd5+
     17533   3&#58;      0.0   +12.00  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Kxe3 Qxc3+
                                   10.Kf2
     28216   4       0.1      &#58;-(  
     30910   4       0.1      &#58;-)  1.Rxd5+
     36858   4&#58;      0.1   +12.53  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Rxe3 Qf2+
                                   10.Kg4
     38212   5       0.1      &#58;-)  1.Rxd5+
     79971   5&#58;      0.2   +16.79  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Rxe3 Qf2+
                                   10.Kg4 Qxf8 11.exf8=Q h1=Q 12.bxc6
    201017   6       0.5      &#58;-(  
    203624   6&#58;      0.5   +16.79  1.Rxd5+ Kxd5 2.Qxd6+ cxd6 3.Nxb6+ Kc5
                                   4.Nd7+ Kd5 5.Nexf6+ gxf6 6.Nxf6+ Kc5
                                   7.Nd7+ Kd5 8.f8=Q Bxe3+ 9.Rxe3 Qf2+
                                   10.Kg4 Qxf8 11.exf8=Q h1=Q 12.bxc6
    206816   7       0.5      &#58;-)  1.Rxd5+
   1924826   7&#58;      2.5  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
   6154537   8       6.1  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
   8468613   8&#58;      8.0  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
  26624058   9      17.5  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
  39706808   9&#58;     24.4  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
 117132659  10      55.2  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
 178180289  10&#58;     80.1  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
 488649340  11     184.9  +Mat_12  1.Rxd5+ Kxd5 2.Naxc7+ Bxc7 3.Nxc7+ Kc5
                                   4.Qxd6+ Kxd6 5.e8=N+ Ke7 6.f8=Q+ Kxf8
                                   7.hxg7+ Ke7 8.Bxf6+ Kf7 9.Be6+ Kg6
                                   10.g8=Q+ Kh6 11.Qg5+ Kh7 12.Bf5#
Yes I think it's correct. Both depth 7 and 2.5s are impressive btw.
Dann Corbit
Posts: 12542
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: What's wrong with this EPD?

Post by Dann Corbit »

michiguel wrote:
hgm wrote:'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...
There is something worse: software that crashes. An engine should reject what it cannot handle, but not more than that. For instance, if an engine has a data structure that admits up to 16 pieces per side and no more, it should reject positions with 17 pieces, otherwise, it will sooner or later crash. On the other hand, there is no reason to reject a position based on a clever retrograde analysis. Most likely, the internal data structures could handle that position. I agree with you in the latter case. However, in many cases, it is not pedantry, it is an acknowledgment of the limitations.

Miguel
I agree with both positions. I think that Abillo positions are tons of fun, though many cannot be achieved in retrograde perspective and so it is a shame to not process them (some engines do refuse). On the other hand, we cannot expect a chess position with 31 white queens and 31 black queens together with one king each to be processed successfully by a chess engine.
ernest
Posts: 2041
Joined: Wed Mar 08, 2006 8:30 pm

Re: What's wrong with this EPD?

Post by ernest »

Jouni wrote:Chessbase says illegal, but Arena accepts:
Shredder GUI also accepts it...