For Marco---possible Stockfish bug

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Robert
Posts: 20
Joined: Tue Oct 07, 2008 2:53 am
Location: Brasil

Re: For Marco---possible Stockfish bug

Post by Robert »

Uri Blass wrote:
I wonder how do you get this output?
Do you use console mode or do you use it under some gui

This is Arena's Log/Engine Debug window. (F4 shortcut)
User avatar
Robert
Posts: 20
Joined: Tue Oct 07, 2008 2:53 am
Location: Brasil

Re: For Marco---possible Stockfish bug

Post by Robert »

Evert wrote: If it fails high (raises alpha >= beta) then it is the best option found so far. What we know at that point is that this line is at least a draw, but we don't have an exact score, only a lower bound. If we need an exact score (for a PV node) then the position will be researched with a wider window.
Stockfish do exactly what you say.

The problem seems to be only in not printing the output before the end of this "wider damn deep very time consuming window research with full depth"!
lech
Posts: 1175
Joined: Sun Feb 14, 2010 10:02 pm

Re: For Marco---possible Stockfish bug

Post by lech »

I think that if someone know and understand negamax should try return function is_draw() (move repetition) by alpha or beta, and not by VALUE_DRAW. :lol:
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: For Marco---possible Stockfish bug

Post by zullil »

Robert wrote:Given:
[d]4kr2/5p1K/3p1Q2/1p4P1/4P3/1PP5/7b/8 w - -

and after 1.Kh6 Be5 2.Kg7 Bh2

we reach this position:
[d]4kr2/5pK1/3p1Q2/1p4P1/4P3/1PP5/7b/8 w - - 4 3

Now looking to engine output when Stockfish must play a move:
Here's the actual engine output:

Code: Select all

Stockfish 2.2.2 64bit SSE4.2 by Tord Romstad, Marco Costalba and Joona Kiiski
uci
id name Stockfish 2.2.2 64bit SSE4.2
id author Tord Romstad, Marco Costalba and Joona Kiiski

option name Use Search Log type check default false
option name Search Log Filename type string default SearchLog.txt
option name Book File type string default book.bin
option name Best Book Move type check default false
option name Mobility (Middle Game) type spin default 100 min 0 max 200
option name Mobility (Endgame) type spin default 100 min 0 max 200
option name Passed Pawns (Middle Game) type spin default 100 min 0 max 200
option name Passed Pawns (Endgame) type spin default 100 min 0 max 200
option name Space type spin default 100 min 0 max 200
option name Aggressiveness type spin default 100 min 0 max 200
option name Cowardice type spin default 100 min 0 max 200
option name Min Split Depth type spin default 7 min 4 max 7
option name Max Threads per Split Point type spin default 5 min 4 max 8
option name Threads type spin default 8 min 1 max 32
option name Use Sleeping Threads type check default false
option name Hash type spin default 2048 min 4 max 8192
option name Clear Hash type button
option name Ponder type check default true
option name OwnBook type check default true
option name MultiPV type spin default 1 min 1 max 500
option name Skill Level type spin default 20 min 0 max 20
option name Emergency Move Horizon type spin default 40 min 0 max 50
option name Emergency Base Time type spin default 200 min 0 max 30000
option name Emergency Move Time type spin default 70 min 0 max 5000
option name Minimum Thinking Time type spin default 20 min 0 max 5000
option name UCI_Chess960 type check default false
option name UCI_AnalyseMode type check default false
uciok
position fen 4kr2/5pK1/3p1Q2/1p4P1/4P3/1PP5/7b/8 w - - 4 3
go infinite
info depth 1 seldepth 1 score cp 387 nodes 59 nps 51 time 1145 multipv 1 pv g5g6
info depth 2 seldepth 4 score cp 339 nodes 421 nps 367 time 1145 multipv 1 pv c3c4 h2e5
info depth 3 seldepth 8 score cp -319 nodes 1722 nps 1502 time 1146 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5
info depth 4 seldepth 8 score cp -319 nodes 1833 nps 1599 time 1146 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5
info depth 5 seldepth 8 score cp -319 nodes 2056 nps 1794 time 1146 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5
info depth 6 seldepth 13 score cp -303 nodes 2705 nps 2360 time 1146 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6
info depth 7 seldepth 13 score cp -319 nodes 3684 nps 3209 time 1148 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8d7
info depth 8 seldepth 15 score cp -339 nodes 5040 nps 4386 time 1149 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6f5 f4e5 f5e6 d8c7
info depth 9 seldepth 18 score cp -339 nodes 9467 nps 8225 time 1151 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8d7 b3b4 f4e5 c3c4
info depth 10 seldepth 18 score cp -327 nodes 25071 nps 21612 time 1160 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8d7 b3b4 f4e5 c3c4 b5c4 d5c4 d7c6 b4b5 c6b6
info depth 11 seldepth 21 score cp -327 nodes 29011 nps 24966 time 1162 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8d7 b3b4 f4e5 c3c4 b5c4 d5c4 d7c6 b4b5 c6b6
info depth 12 seldepth 25 score cp -363 nodes 52251 nps 44658 time 1170 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8c7 c3c4 b5c4 d5c4 f4e5 c4d5 c7b6 d5c4 b6c6 b3b4 c6b6 b4b5 b6a5
info depth 13 seldepth 25 score cp -343 nodes 71487 nps 60685 time 1178 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8c7 c3c4 b5c4 d5c4 c7b6 c4b4 f4e5 b4c4 b6c7 c4d5 c7b6 d5c4
info depth 14 seldepth 25 score cp -355 nodes 85044 nps 71888 time 1183 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8c7 c3c4 b5c4 d5c4 c7b6 c4b4 f4e5 b4c4 b6c6 b3b4 c6b6 c4d3 b6b5
info depth 15 seldepth 28 score cp -383 nodes 120294 nps 100580 time 1196 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8c7 c3c4 b5c4 b3c4 c7b6 d5d4 b6c6 d4d3 c6c5 d3c3 f4e5 c3d3 e5d4
info depth 16 seldepth 28 score cp -379 nodes 169135 nps 140244 time 1206 multipv 1 pv f6d8 e8d8 g7f8 h2f4 f8f7 f4g5 f7e6 g5f4 e6d5 d8c7 d5d4 f4e5 d4d3 c7d7 d3c2 e5f4 c2d3 d7c6 d3e2 f4e5 e2d3 e5f4
info depth 17 seldepth 29 score cp 0 nodes 293716 nps 234036 time 1255 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 18 seldepth 29 score cp 0 nodes 308717 nps 245208 time 1259 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 19 seldepth 29 score cp 0 nodes 330028 nps 261098 time 1264 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 20 seldepth 29 score cp 0 nodes 343269 nps 270716 time 1268 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 21 seldepth 29 score cp 0 nodes 376397 nps 295213 time 1275 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 22 seldepth 29 score cp 0 nodes 412153 nps 321241 time 1283 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 23 seldepth 29 score cp 0 nodes 465048 nps 359387 time 1294 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 24 seldepth 29 score cp 0 nodes 565814 nps 430932 time 1313 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 25 seldepth 29 score cp 0 nodes 663049 nps 498533 time 1330 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 26 seldepth 29 score cp 0 nodes 720023 nps 536130 time 1343 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 27 seldepth 29 score cp 0 nodes 948463 nps 687790 time 1379 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 28 seldepth 29 score cp 0 nodes 1057448 nps 754242 time 1402 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 29 seldepth 29 score cp 0 nodes 1148220 nps 808605 time 1420 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 30 seldepth 29 score cp 0 nodes 1267750 nps 879770 time 1441 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 31 seldepth 29 score cp 0 nodes 1971765 nps 1279536 time 1541 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 32 seldepth 29 score cp 0 nodes 2213626 nps 1401916 time 1579 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 33 seldepth 29 score cp 0 nodes 3837677 nps 2148755 time 1786 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 34 seldepth 29 score cp 0 nodes 4226260 nps 2278307 time 1855 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 35 seldepth 29 score cp 0 nodes 4996038 nps 2538637 time 1968 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 36 currmove f6f5 currmovenumber 4
info depth 36 seldepth 29 score cp 0 nodes 6121346 nps 2892885 time 2116 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 37 currmove f6f1 currmovenumber 1
info depth 37 currmove f6f5 currmovenumber 4
info depth 37 currmove e4e5 currmovenumber 9
info depth 37 currmove f6d8 currmovenumber 15
info depth 37 currmove f6f3 currmovenumber 18
info depth 37 seldepth 29 score cp 0 nodes 7743378 nps 3296457 time 2349 multipv 1 pv f6f1 h2e5 f1f6 e5h2
info depth 38 currmove f6f1 currmovenumber 1
info depth 38 currmove c3c4 currmovenumber 6
info depth 38 seldepth 51 score cp 8 lowerbound nodes 11028349 nps 3389166 time 3254 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 16 lowerbound nodes 12240357 nps 3047138 time 4017 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 28 lowerbound nodes 15209817 nps 2489331 time 6110 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 46 lowerbound nodes 16718930 nps 2410804 time 6935 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 73 lowerbound nodes 17934432 nps 2360725 time 7597 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 114 lowerbound nodes 19257148 nps 2340440 time 8228 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 175 lowerbound nodes 22038650 nps 2041182 time 10797 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 267 lowerbound nodes 27494737 nps 2028682 time 13553 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 404 lowerbound nodes 45777585 nps 2696606 time 16976 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 51 score cp 609 lowerbound nodes 67872606 nps 3499489 time 19395 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 52 score cp 916 lowerbound nodes 84291543 nps 3992778 time 21111 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 52 score cp 1377 lowerbound nodes 123009665 nps 4986406 time 24669 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 57 score cp 2069 lowerbound nodes 176954931 nps 5940078 time 29790 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 57 score cp 3106 lowerbound nodes 302368717 nps 7188643 time 42062 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 57 score cp 4661 lowerbound nodes 346450421 nps 7366113 time 47033 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 57 score cp 6993 lowerbound nodes 358599292 nps 7384055 time 48564 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5f6 g5f6 f8h8 g7h8 e8d7 h8g7 d7e6 d6d7
info depth 38 currmove c3c4 currmovenumber 1
info depth 38 seldepth 57 score cp 10491 lowerbound nodes 1314686775 nps 9754895 time 134772 multipv 1 pv c3c4 b5c4 e4e5 h2e5 b3c4 e5h2 c4c5 h2e5 c5d6 e5b2 f6b2 e8d7 g7f8 d7e6 d6d7 e6f5 f8f7 f5g5 b2g2 g5f4 d7d8q
info depth 39 currmove c3c4 currmovenumber 1
stop
bestmove c3c4 ponder b5c4
quit
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: For Marco---possible Stockfish bug

Post by Evert »

lech wrote:Thanks Evert that you see a problem too and you didin't write that I am an idiot and must rethink somethink. :D
I'm not sure I said I see a problem. What I see (and whate everyone knows) is that an incorrect evaluation can cause incorrect play. This is not particular to repetition detection and the solution is not a fudge of the alpha-beta algorithm.
lech
Posts: 1175
Joined: Sun Feb 14, 2010 10:02 pm

Re: For Marco---possible Stockfish bug

Post by lech »

Returning the function is_draw by VALUE_DRAW may result in a bad move. The use of alpha or alpha + 1 makes it possible to get a human chess engine by changing the value ​​for the rule-50. It did Robert Houdart. But he probably used the wrong VALUE_DRAW too. It is now safe and can give a splendid effect in the game and analysis.
Wide thinking! :D
lech
Posts: 1175
Joined: Sun Feb 14, 2010 10:02 pm

Re: For Marco---possible Stockfish bug

Post by lech »

Again I try to prove my THEORY (in other way), that it is wrong (for negamax) that there is only one VALUE_DRAW (= 0), and two sides.

I did a change in the Stockfish code.
Now, when the function is_draw() returns true, it results in VALUE_DRAW - 1 (not VALUE_DRAW).
Probably it is possible to change VALUE_DRAW = -1 in types.h directly.

This version found solution (PIV - 2 threads, hash = 1024, all the rest = default, Clear Hash before each test)
[d] 4kr2/5p1K/3p1Q2/1p4P1/4P3/1PP5/7b/8 w - - 0 1

Code: Select all

 
 46/38	03:38	 162.251.941	743.637	 0,00	b3b4 Bh2e5 Kh7g7 Be5h2 Kg7h7
 47/58	14:55	 667.641.343	745.708	+0,08	Kh7h6 Bh2e5 Kh6g7 Be5g3 c3c4 b5xc4 e4e5 Bg3xe5 b3xc4 Be5xf6+ g5xf6
I repeated the test after restart.

Code: Select all

 42/71	06:41	 339.668.903	847.020	 0,00	b3b4 Bh2e5 Kh7g7 Be5g3 Qf6f5 Bg3e5+ Qf5f6
 43/71	07:44	 379.169.915	816.022	+0,08	Kh7h6 Bh2e5 Kh6g7 Be5xf6+ g5xf6 b5b4 c3xb4 d6d5 e4xd5
It seems to be a very good result in comparing to the original version.

Of course, I tried to test it in play too.
I terminated test after 100 games (tc = 60 + 0,2) with result sfx - sf: +26 -23 =51
IMO it needs much deeper play (faster computer) to test any possible diferences.

Thanks Louis that you developed this topic. IMO it is a logical bug, but as you see I am alone.
It is a next example where a logical thinking can lose with the speed (alpha + 1 = VALUE_DRAW).
For this reason it is (and will be) tolerated by programmers.
lech
Posts: 1175
Joined: Sun Feb 14, 2010 10:02 pm

Re: For Marco---possible Stockfish bug

Post by lech »

lech wrote:

Code: Select all

 
 46/38	03:38	 162.251.941	743.637	 0,00	b3b4 Bh2e5 Kh7g7 Be5h2 Kg7h7
 47/58	14:55	 667.641.343	745.708	+0,08	Kh7h6 Bh2e5 Kh6g7 Be5g3 c3c4 b5xc4 e4e5 Bg3xe5 b3xc4 Be5xf6+ g5xf6
I repeated the test after restart.

Code: Select all

 42/71	06:41	 339.668.903	847.020	 0,00	b3b4 Bh2e5 Kh7g7 Be5g3 Qf6f5 Bg3e5+ Qf5f6
 43/71	07:44	 379.169.915	816.022	+0,08	Kh7h6 Bh2e5 Kh6g7 Be5xf6+ g5xf6 b5b4 c3xb4 d6d5 e4xd5
It seems to be a very good result in comparing to the original version.
The original SF's (compiled by me in the same way as earler) test (the same conditions) I terminated after 1 hour on 51 depth. No solution.
lech
Posts: 1175
Joined: Sun Feb 14, 2010 10:02 pm

Re: For Marco---possible Stockfish bug

Post by lech »

It is a pity that such an interesting theme turns out to be my blog only :? .

I found (very quickly) a next simpler (but classic) example.
[d]8/7P/8/8/K7/p1b5/1k6/1B6 b - - 0 1

Code: Select all

Sfx (VALUE_DRAW = -1):
  6/7	00:02	       2.730	1.134	 0,00	Bc3e5 Ka4b4 a3a2 Bb1xa2 Kb2c1 Kb4a4 Be5c3 h7h8R Bc3xh8 Ka4b5
  7/9	00:02	       3.850	1.569	 0,00	Bc3e5 Ka4b4 a3a2 Bb1xa2 Kb2c1 Kb4a4 Kc1d1 Ka4b5 Be5b2
  8/10	00:02	       9.262	3.751	+0,44	Bc3e5 Ka4b4 Be5d4 Kb4a4 Bd4c3 h7h8N Bc3xh8 Ka4b4 Bh8c3+ Kb4a4

Code: Select all

Sf (VALUE_DRAW = 0):

 13/8	00:02	      18.460	7.476	 0,00	a3a2 Bb1xa2 Bc3d4 h7h8R Bd4xh8 Ba2b1 Kb2xb1
 14/8	00:02	      24.538	9.874	 0,00	a3a2 Bb1xa2 Bc3d4 h7h8R Bd4xh8 Ba2b1 Kb2xb1
 15/30	00:03	     781.802	227.400	+10,34	Bc3d4 Ka4b4 Bd4e5 Kb4a4 Be5c3 h7h8N Bc3xh8 Ka4b4 Bh8e5 Kb4a4 Be5d6 Bb1f5 a3a2 Ka4b5 a2a1Q Bf5e6 Qa1c1 Be6c4 Qc1g5+ Kb5a4
A 7-depth difference (!) :shock:
What about two VALUE_DRAW ? :D
Joerg Oster
Posts: 991
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany
Full name: Jörg Oster

Re: For Marco---possible Stockfish bug

Post by Joerg Oster »

Hi Marek,

what you are doing seems to me like an artificial contempt factor.
Of course, it will sometimes help.
Jörg Oster