ddugovic / Stockfish

Retired multi-variant fork of popular UCI chess engine; please use Fairy-Stockfish instead
https://github.com/ianfab/Fairy-Stockfish
GNU General Public License v3.0
132 stars 44 forks source link

Another atomic assert fail #466

Closed benwh1 closed 6 years ago

benwh1 commented 6 years ago
setoption name UCI_Variant value atomic
info string variant atomic startpos rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
setoption name Threads value 16
setoption name Hash value 7600
position startpos moves g1f3 e7e5 f3g5 f7f5 d2d4 b7b6

info depth 40 seldepth 56 multipv 1 score cp 912 lowerbound nodes 193902775628 nps 12256440 hashfull 999 tbhits 0 time 15820480 pv e2e4
sf2_debug: search.cpp:1653: Value {anonymous}::qsearch(Position&, Search::Stack*, Value, Value, Depth) [with {anonymous}::NodeType NT = (<unnamed>::NodeType)0u; bool InCheck = true]: Assertion `value > -VALUE_INFINITE && value < VALUE_INFINITE' failed.

Again, it's not until deep in the search so it's hard to reproduce... This was done on the latest version from 5 days ago. I can re-run it with any potential fixes if nothing is found to reproduce it in a reasonable amount of time.

ianfab commented 6 years ago

@benwh1 Thanks for the report. I suspected that this is caused by evaluation overflows due to big values in the quadratic king safety evaluation terms, so I constructed a one-sided position where the failed assertion can be reproduced very quickly and the eval command apparently also shows an overflowed value, see below. If I remember correctly, we solved similar issues in crazyhouse by (re-)introducing a cutoff on the king danger score, which is not really an elegant solution, but it should do the trick. I will do some tests on the effect of introducing such a limit for atomic chess. The issue might also exist for other variants, e.g., three-check (Edit: I forgot that we already introduced the same cutoff for three-check, so no issue there).

setoption name UCI_Variant value atomic
position fen 4k3/R6Q/3QN3/8/5R1B/6QQ/1r6/K7 b - - 0 1
d
eval
go infinite
 +---+---+---+---+---+---+---+---+
 |   |   |   |   | k |   |   |   |
 +---+---+---+---+---+---+---+---+
 | R |   |   |   |   |   |   | Q |
 +---+---+---+---+---+---+---+---+
 |   |   |   | Q | N |   |   |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   |   |   | R |   | B |
 +---+---+---+---+---+---+---+---+
 |   |   |   |   |   |   | Q | Q |
 +---+---+---+---+---+---+---+---+
 |   | r |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+
 | K |   |   |   |   |   |   |   |
 +---+---+---+---+---+---+---+---+

Fen: 4k3/R6Q/3QN3/8/5R1B/6QQ/1r6/K7 b - - 0 1
Key: 11A552CF1CF7E1B2
Checkers: 
      Eval term |    White    |    Black    |    Total    
                |   MG    EG  |   MG    EG  |   MG    EG  
----------------+-------------+-------------+-------------
       Material |   ---   --- |   ---   --- | 32.20 41.47 
      Imbalance |   ---   --- |   ---   --- |  0.24  0.24 
          Pawns |   ---   --- |   ---   --- |  0.00  0.00 
        Knights |  0.12 -0.05 |  0.00  0.00 |  0.12 -0.05 
        Bishops | -0.04 -0.07 |  0.00  0.00 | -0.04 -0.07 
          Rooks |  0.24  0.17 |  0.11  0.08 |  0.12  0.08 
         Queens | -0.10  0.10 |  0.00  0.00 | -0.10  0.10 
       Mobility |  2.32  3.80 |  0.24  0.66 |  2.08  3.14 
    King safety | -1.09 -0.33 | -120.83 -16.34 | 119.75 16.00 
        Threats |  0.00  0.00 |  0.00  0.00 |  0.00  0.00 
   Passed pawns |  0.00  0.00 |  0.00  0.00 |  0.00  0.00 
          Space |  0.14  0.00 |  0.20  0.00 | -0.07  0.00 
     Initiative |   ---   --- |   ---   --- |  0.00 -0.67 
----------------+-------------+-------------+-------------
          Total |   ---   --- |   ---   --- | -118.77 60.25 

Total Evaluation: -118.85 (white side)

info depth 1 seldepth 2 multipv 1 score cp 11896 nodes 29 nps 29000 tbhits 0 time 1 pv b2b1 a1a2
info depth 2 seldepth 4 multipv 1 score cp 11896 nodes 95 nps 95000 tbhits 0 time 1 pv b2a2 a1b1 a2b2 b1a1
info depth 3 seldepth 6 multipv 1 score cp 11854 nodes 182 nps 182000 tbhits 0 time 1 pv b2a2 a1b1 a2b2 b1a1 b2b1 a1a2
info depth 4 seldepth 8 multipv 1 score cp 11851 nodes 265 nps 265000 tbhits 0 time 1 pv b2a2 a1b1 a2b2 b1a1 b2b1 a1a2 b1a1 a2b2
info depth 5 seldepth 6 multipv 1 score cp 0 nodes 475 nps 237500 tbhits 0 time 2 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 6 seldepth 6 multipv 1 score cp 0 nodes 691 nps 345500 tbhits 0 time 2 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 7 seldepth 6 multipv 1 score cp 0 nodes 893 nps 446500 tbhits 0 time 2 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 8 seldepth 6 multipv 1 score cp 0 nodes 1252 nps 417333 tbhits 0 time 3 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 9 seldepth 6 multipv 1 score cp 0 nodes 1631 nps 543666 tbhits 0 time 3 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 10 seldepth 6 multipv 1 score cp 0 nodes 1976 nps 494000 tbhits 0 time 4 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 11 seldepth 6 multipv 1 score cp 0 nodes 2527 nps 505400 tbhits 0 time 5 pv b2a2 a1b1 a2b2 b1a1 b2a2
info depth 12 seldepth 6 multipv 1 score cp 0 nodes 3314 nps 552333 tbhits 0 time 6 pv b2a2 a1b1 a2b2 b1a1 b2a2
stockfish: search.cpp:1338: Value {anonymous}::search(Position&, Search::Stack*, Value, Value, Depth, bool, bool) [with {anonymous}::NodeType NT = (<unnamed>::NodeType)0u]: Assertion `value > -VALUE_INFINITE && value < VALUE_INFINITE' failed.