Problems with TT, sometimes makes blunder moves

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Problems with TT, sometimes makes blunder moves

Post by Henk »

Don't talk about Skipper

Code: Select all

Depth  Value   Time(seconds)   Nodes
200    1.3800      45.94    39826580   e1d1 e8d7 d1d2 d7c7 e2e4 c7d8 e4e5 d8e8 d2e2 e8e7 e2f3 e7d7 f3g3 d7d8 g3f2 d8c7 f2e2 c7d7 e2d3 d7c7 d3c4 
190    1.4720      19.59    18247112   e1d2 e8d8 e2e4 d8e8 e4e5 e8d8 d2c2 d8c8 c2c3 c8b7 c3d2 b7b6 d2d3 b6c7 d3c4 c7d8 c4c5 d8d7 c5d4 d7e6 
180    1.4360       9.07     8272896   e1d2 e8d8 e2e4 d8e8 e4e5 e8e7 d2d3 e7f7 d3e3 f7e6 e3f4 e6d7 f4f3 d7d8 f3f2 d8d7 f2e1 d7c8 
170    1.3930       5.68     5459073   e1d2 e8d8 e2e4 d8e8 e4e5 e8e7 d2d3 e7f7 d3e3 f7e8 e3e2 e8e7 e2f3 e7e8 f3g4 e8d7 g4f3 
160    1.3170       1.89     1984436   e1d2 e8d7 d2c3 d7c7 c3d3 c7b6 e2e4 b6c5 d3e3 c5c6 e4e5 c6d7 e3d3 d7e8 d3c3 e8d8 c3d2 
150    1.3840       2.12     1927352   e1d2 e8d7 d2c3 d7c7 c3d3 c7b6 e2e4 b6c6 d3e3 c6c7 e4e5 c7d8 e3d2 d8e8 d2c2 
140    1.2090       0.53      536139   e1d2 e8d7 d2c3 d7c7 c3d3 c7b6 e2e4 b6c5 d3c3 c5c6 c3c4 c6d6 c4d4 d6e7 
130    1.3210       0.47      375811   e1d2 e8d7 d2c3 d7c7 c3d3 c7b6 e2e4 b6c5 d3c3 c5c6 c3c4 c6d7 e4e5 d7e7 
120    1.2860       0.27      297416   e1d2 e8d7 e2e4 d7d6 d2c2 d6e5 c2d3 e5f6 d3d2 f6e6 d2c1 e6e7 c1c2 
110    1.3480       0.14      149433   e1f2 e8e7 e2e3 e7d6 f2e2 d6e5 e2d3 e5f5 e3e4 f5e6 d3e2 
100    1.2110       0.04       36442   e1f1 e8d7 e2e4 d7c6 f1e1 c6d6 e1d2 d6e6 d2c1 e6e7 
 90    1.3350       0.02       27137   e1f2 e8e7 e2e3 e7d6 f2e2 d6e5 e2d3 e5f5 e3e4 
 80    1.2610       0.01       13501   e1f1 e8d7 e2e4 d7c6 f1e1 c6d6 e1d1 d6e7 
 70    1.0200       0.01        9483   e1d1 e8f7 d1c1 f7e7 c1b1 e7e8 b1a1 
 60    1.0400       0.01        2283   e1d1 e8f8 d1c1 f8e8 c1b1 e8f8 
 50    1.3670       0.00         484   e2e4 e8d8 e4e5 d8e8 e1d1 
 40    1.0600       0.00         221   e1d1 e8f8 d1c1 f8e8 
 30    1.3960       0.01         171   e2e4 e8d8 e4e5 
 20    1.0800       0.00          26   e1d1 e8f8 
 10    1.0800       0.03          13   e1d1 
flok

Re: Problems with TT, sometimes makes blunder moves

Post by flok »

No TT hit at all?!
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Problems with TT, sometimes makes blunder moves

Post by Henk »

It only uses TT for move ordering.
flok

Re: Problems with TT, sometimes makes blunder moves

Post by flok »

But stockfish neither:

Code: Select all

15:42:13 folkert@belle:~ $ stockfish
Stockfish 6 64 by Tord Romstad, Marco Costalba and Joona Kiiski
position fen 4k3/8/8/8/8/8/4P3/4K3 w - - 0 0
go
info depth 1 seldepth 1 multipv 1 score cp 3976 nodes 7 nps 7000 tbhits 0 time 1 pv e1d2
info depth 2 seldepth 2 multipv 1 score cp 3976 nodes 22 nps 22000 tbhits 0 time 1 pv e1d2 e8d7
info depth 3 seldepth 3 multipv 1 score cp 0 nodes 53 nps 53000 tbhits 0 time 1 pv e1d2 e8d7 e2e3
info depth 4 seldepth 4 multipv 1 score cp 3976 nodes 124 nps 124000 tbhits 0 time 1 pv e1d2 e8d7 d2c3 d7d6
info depth 5 seldepth 5 multipv 1 score cp 0 nodes 194 nps 194000 tbhits 0 time 1 pv e1d2 e8d7 d2c3 d7d6 e2e3
info depth 6 seldepth 6 multipv 1 score cp 0 nodes 394 nps 197000 tbhits 0 time 2 pv e1d2 e8d7 d2c3 d7e6 c3d3 e6d6
info depth 7 seldepth 7 multipv 1 score cp 3976 nodes 961 nps 480500 tbhits 0 time 2 pv e1f2 e8d7 f2f3 d7d6 f3f4 d6e6 f4e4
info depth 8 seldepth 8 multipv 1 score cp 3976 nodes 1255 nps 627500 tbhits 0 time 2 pv e1f2 e8d7 f2f3 d7d6 f3f4 d6e6 f4e4 e6d7
info depth 9 seldepth 9 multipv 1 score cp 3976 nodes 1934 nps 967000 tbhits 0 time 2 pv e1d2 e8d7 d2d3 d7d6 d3e4 d6e6 e4f4 e6e7 f4f3
info depth 10 seldepth 12 multipv 1 score cp 0 nodes 8401 nps 2800333 tbhits 0 time 3 pv e1f2 e8f8 f2f3 f8f7 f3f4 f7f6 e2e3 f6e6 f4e4 e6f6 e4f4
info depth 11 seldepth 12 multipv 1 score cp 0 nodes 9547 nps 2386750 tbhits 0 time 4 pv e1f2 e8f8 f2f3 f8f7 f3f4 f7f6 e2e3 f6e6 f4e4 e6f6 e4f4
info depth 12 seldepth 12 multipv 1 score cp 0 nodes 11382 nps 2845500 tbhits 0 time 4 pv e1f2 e8f8 f2f3 f8f7 f3f4 f7f6 e2e3 f6e6 f4e4 e6f6 e4f4
info depth 13 seldepth 17 multipv 1 score cp 3976 nodes 17432 nps 3486400 tbhits 0 time 5 pv e1d2 e8d8 d2c3 d8e7 c3d3 e7d7 d3e4 d7e6 e2e3 e6f6 e4d5 f6e7 d5e5
info depth 14 seldepth 17 multipv 1 score cp 3977 nodes 21316 nps 3552666 tbhits 0 time 6 pv e1f2 e8f8 f2f3 f8f7 f3e4 f7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f7
info depth 15 seldepth 17 multipv 1 score cp 3977 nodes 26189 nps 3741285 tbhits 0 time 7 pv e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f7 e3e4
info depth 16 seldepth 17 multipv 1 score cp 3977 nodes 28079 nps 4011285 tbhits 0 time 7 pv e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f7 e3e4 f7f6
info depth 17 seldepth 18 multipv 1 score cp 3977 nodes 30761 nps 3845125 tbhits 0 time 8 pv e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f7 e3e4 f7f6 e4e5 f6f5
info depth 18 seldepth 19 multipv 1 score cp 3977 nodes 33821 nps 3757888 tbhits 0 time 9 pv e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f7 e3e4 f7f6 e4e5 f6f7 d6d7
info depth 19 seldepth 20 multipv 1 score cp 3977 nodes 37555 nps 4172777 tbhits 0 time 9 pv e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f7 e3e4 f7f6 e4e5 f6f7 d6d7 f7f8
info depth 20 seldepth 21 multipv 1 score cp 3977 nodes 42839 nps 4283900 tbhits 0 time 10 pv e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7e8 e5d6 e8f8 e3e4 f8f7 e4e5 f7e8 d6e6 e8d8
info nodes 48496 time 11
bestmove e1f2 ponder e8f8
@hgm: what's the deal with that promotion :-)
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Problems with TT, sometimes makes blunder moves

Post by hgm »

Henk wrote:It only uses TT for move ordering.
Then you cannot expect the engine to find it at all. Each side has about 8 moves here, so a 20-ply minimax tree would have 8^20 ~ 10^18 nodes, and a perfectly ordered alpha-beta tree about the square root of that (10^9 nodes). Of course there are only a few times 64 x 64 positions possible, as a King can only reach 64 squares after 10 moves, not 8^10 = 1 billion. All the billion lines are transpositions of just 64 positions. But without hash cutoff, you would have to search them all.

Fairy-Max needs 24 ply to see the promotion:

Code: Select all

 24	+8.20 	5.90M  	0:04.70	e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7f7 e5d6 f7e8 e3e4 e8d8 e4e5 d8c8 d6e7 c8c7 e5e6 c7b6 e7f6 b6c6
 23	+2.04 	2.19M  	0:01.76	e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7f7 e5d6 f7g7 d6d5
 22	+1.96 	1.74M  	0:01.40	e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7f7 e5d6 f7g7 e3e4 g7h7 e4e5 h7h6
 21	+1.72 	1.47M  	0:01.20	e1f2 e8f8 f2e3 f8e7 e3e4 e7e6 e2e3 e6f6 e4d5 f6e7 d5e5 e7f8
 20	+1.46 	1.27M  	0:01.03	e1f2 e8f8 f2e3 f8e7 e3d4 e7d6 e2e4 d6e6 e4e5 e6e7 d4d5 e7d7 e5e6 d7e7
 19	+1.46 	1.00M  	0:00.81	e1f2 e8e7 f2e3 e7f7 e3f4 f7g7 f4f5 g7f7 e2e4 f7e7 e4e5 e7f7 e5e6 f7e7 f5e5 e7e8 e5e4 e8f8 e4f4
 19	+1.45 	957712	0:00.78	e1d2 e8f8 d2d3 f8f7 d3d4 f7e6 e2e4 e6d6 e4e5 d6e6 d4e4 e6e7 e4f5 e7f7 e5e6 f7e7 f5e5 e7e8 e5f5
 18	+1.46 	794458	0:00.65	e1d2 e8f8 d2d3 f8f7 d3d4 f7e6 e2e4 e6d6 e4e5 d6e6 d4e4 e6e7 e4f5
 18	+1.45 	734477	0:00.61	e1f2 e8e7 f2e3 e7d6 e3e4 d6e6 e4d4 e6d6 e2e4 d6d7 d4d5 d7e7
 17	+1.37 	449935	0:00.37	e1f2 e8e7 f2e3 e7d6 e3e4 d6e6 e4d4 e6d6 e2e4 d6e6 e4e5 e6e7 d4d5
 16	+1.37 	368568	0:00.31	e1f2 e8e7 f2e3 e7d6 e3d4 d6e6 e2e4 e6d6 e4e5 d6e6 d4e4
 15	+1.36 	296539	0:00.25	e1f2 e8e7 f2f3 e7d6 f3f4 d6e6 e2e4 e6f6 e4e5 f6e6 f4e4 e6f7
 14	+1.35 	188177	0:00.15	e1f2 e8e7 f2f3 e7d6 f3e4 d6e6 e4f4
 13	+0.90 	104180	0:00.07	e1f2 e8e7 f2f3 e7d6 f3e4 d6e6 e4f4
 12	+0.79 	57359  	0:00.04	e1f2 e8e7 e2e4 e7e6 f2e3 e6e5 e3f3 e5e6 f3f4 e6f6 e4e5 f6e6
 11	+0.79 	36030  	0:00.03	e1f2 e8e7 e2e4 e7e6 f2e3 e6e5 e3f3 e5e6 f3f4 e6f6 e4e5
 10	+0.79 	20202  	0:00.01	e1f2 e8e7 e2e4 e7e6 f2e3 e6e5 e3f3 e5d4 f3f4 d4d3
  9	+0.79 	11869  	0:00.00	e1f2 e8e7 e2e4 e7e6 f2f3 e6e5 f3e3 e5e6 e3f4
  8	+0.79 	6753    	0:00.00	e1f2 e8e7 e2e4 e7e6 f2f3 e6e5 f3e3 e5e6
  7	+0.79 	4092    	0:00.00	e1f2 e8e7 f2e3 e7e6 e3e4
  6	+0.78 	1355    	0:00.00	e1f2 e8e7 e2e4 e7e6 f2e3 e6e5
  5	+0.79 	614      	0:00.00	e1f2 e8e7 e2e4 e7e6 f2e3
  4	+0.75 	194      	0:00.00	e1f2 e8e7 e2e4 e7e6
  3	+0.79 	85        	0:00.00	e1f2 e8e7 e2e4
  2	+0.73 	19        	0:00.00	e1f2 e8e7
  1	+0.79 	11        	0:00.00	e1f2
Seems you had Stockfish only search for 11 msec, and it did not reach beyond 20 ply.
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Problems with TT, sometimes makes blunder moves

Post by JVMerlino »

flok wrote:At what minimum search depth should it find the promotion? 11?

Because I think there then indeed may be something fishy with my program:

Code: Select all

14:14:31 folkert@belle:~/Projects/QueenBee/tags/v0.9.1_2205/trunk trunk(18) 11s ‡ ./Embla -H 4096 -p initial_fen='4k3/8/8/8/8/8/4P3/4K3 w - - 0 0'
go
info depth 1 seldepth 1 score cp 155 time 1 nodes 7 pv e2e4
info depth 2 seldepth 2 score cp 148 time 1 nodes 25 pv e2e4 e8d7
info depth 3 seldepth 3 score cp 179 ebf 2.17 time 1 nodes 58 pv e2e4 e8d7 e4e5
info depth 4 seldepth 4 score cp 172 ebf 1.78 time 1 nodes 115 pv e2e4 e8d7 e4e5 d7e6
info depth 5 seldepth 6 score cp 155 ebf 2.35 time 1 nodes 297 pv e2e4 e8d7 e1d2 d7e6 d2d3
info depth 6 seldepth 6 score cp 152 ebf 2.28 time 2 nodes 594 pv e2e4 e8d7 e1d2 d7e6 d2d3 e6e5
info depth 7 seldepth 8 score cp 152 ebf 1.68 time 2 nodes 1106 pv e2e4 e8d7 e1d2 d7e6 d2d3 e6e5 d3e3
info depth 8 seldepth 8 score cp 155 ebf 1.61 time 4 nodes 1879 pv e2e4 e8d7 e1d2 d7e6 d2d3 e6e5 d3e3 e5d6
info depth 9 seldepth 10 score cp 157 ebf 1.35 time 6 nodes 2806 pv e2e4 e8d7 e1d2 d7e6 d2d3 e6e5 d3e3 e5d6 e3d4
info depth 10 seldepth 10 score cp 157 ebf 1.12 time 8 nodes 3776 pv e2e4 e8d7 e1d2 d7e6 d2d3 e6e5 d3e3 e5d6
info depth 11 seldepth 12 score cp 188 ebf 1.73 time 13 nodes 6536 pv e2e4 e8d7 e1d2 d7e6 d2d3 e6e5 d3e3 e5d6 e3d4 d6e6 e4e5
info depth 12 seldepth 13 score cp 188 ebf 2.49 time 19 nodes 12531 pv e1d2 e8d7 d2d3 d7e6 d3d4 e6d6 e2e4 d6e6 e4e5 e6f5 d4d5 f5f4
info depth 13 seldepth 14 score cp 196 ebf 1.53 time 25 nodes 18986 pv e1d2 e8d7 d2d3 d7d6 d3d4 d6c6 e2e4 c6c7 e4e5 c7c6 d4e4
info depth 14 seldepth 15 score cp 240 ebf 1.07 time 31 nodes 25793 pv e1d2 e8d7 d2d3 d7d6 d3d4 d6c6 e2e4 c6b5 d4d5 b5b4 e4e5 b4c3 e5e6 c3d3
info depth 15 seldepth 16 score cp 240 ebf 1.02 time 36 nodes 32491 pv e1d2 e8d7 d2d3 d7d6 d3d4 d6c6 e2e4 c6d6 e4e5 d6e6 d4e4 e6f7 e4d5 f7g6
info depth 16 seldepth 17 score cp 240 ebf 1.08 time 40 nodes 40396 pv e1d2 e8d7 d2d3 d7d6 d3d4 d6c6 e2e4 c6d6 e4e5 d6e6 d4e4 e6f7 e4d5 f7g6 e5e6 g6f6 d5d6
info depth 17 seldepth 18 score cp 240 ebf 1.31 time 47 nodes 51975 pv e1d2 e8d7 d2d3 d7d6 d3d4 d6c6 e2e4 c6d6 e4e5 d6e6 d4e4 e6f7 e4d5 f7g6 d5d4 g6f5
info depth 18 seldepth 20 score cp 183 ebf 2.01 time 66 nodes 83886 pv e1d2 e8d7 d2d3 d7d6 d3d4 d6c6 e2e4 c6d6 d4d3 d6c5 d3e3 c5d6 e3f4 d6e6 e4e5 e6d5 f4f5 d5d4
info depth 19 seldepth 20 score cp 260 ebf 2.32 time 105 nodes 146466 pv e1d2
info depth 19 seldepth 19 score cp 255 ebf 0.40 time 108 nodes 151543 pv e1d2
info depth 20 seldepth 22 score cp 330 ebf 0.87 time 140 nodes 199023 pv e1d2
info depth 20 seldepth 20 score cp 330 ebf 1.18 time 144 nodes 206097 pv e1d2
info depth 21 seldepth 23 score cp 327 ebf 1.32 time 193 nodes 288475 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6c7 e4d5 c7b6 d5d6 b6b7 e2e4 b7c8 e4e5 c8d8 d6d5
info depth 22 seldepth 24 score cp 317 ebf 3.13 time 232 nodes 357975 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6c7 e4d5 c7d7 d5e5 d7d8
info depth 23 seldepth 24 score cp 317 ebf 0.91 time 270 nodes 425860 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6c7 e4d5
info depth 24 seldepth 26 score cp 317 ebf 1.31 time 338 nodes 545759 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d7
info depth 25 seldepth 27 score cp 317 ebf 1.45 time 416 nodes 688536 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d7
info depth 26 seldepth 28 score cp 317 ebf 1.35 time 536 nodes 906370 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d7 d4d5 d7e8 d5e5 e8f7 e5d4 f7e7
info depth 27 seldepth 29 score cp 317 ebf 1.36 time 681 nodes 1171123 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d7
info depth 28 seldepth 30 score cp 260 ebf 1.60 time 991 nodes 1728156 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d6 e2e3 d6e6 e3e4 e6d6 d4e3
info depth 29 seldepth 30 score cp 260 ebf 1.35 time 1255 nodes 2211080 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d6 e2e3 d6e6 e3e4 e6d6 d4e3
info depth 30 seldepth 32 score cp 260 ebf 1.07 time 1596 nodes 2845067 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d6 e2e3 d6e6 e3e4 e6d6 d4e3
info depth 31 seldepth 33 score cp 260 ebf 1.34 time 2068 nodes 3708316 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d6 e2e3 d6e6 e3e4 e6d6 d4e3
info depth 32 seldepth 34 score cp 260 ebf 1.66 time 3013 nodes 5447405 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d6 e2e3 d6e6 d4e4 e6d6
info depth 33 seldepth 35 score cp 312 ebf 1.25 time 3754 nodes 6791971 pv e1d2 e8d7 d2e3 d7c6 e3f4 c6d6 f4e4 d6e6 e4d4 e6d6 e2e3 d6e6 d4e4 e6d6 e4f5
info depth 34 seldepth 36 score cp 310 ebf 1.13 time 4977 nodes 9023402 pv e1d2 e8d7 d2e3 d7e6 e3d4 e6d6 e2e3 d6e6 d4e4 e6d6 e4f5 d6e7 f5e5 e7f7
info depth 35 seldepth 36 score cp 310 ebf 1.23 time 6140 nodes 11069652 pv e1d2 e8d7 d2e3 d7e6 e3d4 e6d6 e2e3 d6e6 d4e4 e6d6 e4f5 d6e7 f5e5 e7f7 e3e4 f7e7 e5d5
info depth 36 seldepth 37 score cp 310 ebf 1.18 time 7830 nodes 14166696 pv e1d2 e8d7 d2e3 d7e6 e3d4 e6d6 e2e3 d6e6 d4e4 e6d6 e4f5 d6e7 f5e5 e7f7 e3e4 f7e7 e5d5
info depth 37 seldepth 39 score cp 310 ebf 1.49 time 10335 nodes 18730510 pv e1d2 e8d7 d2e3 d7e6 e3d4 e6d6 e2e3 d6e6 d4e4 e6d6 e4f5 d6e7 f5e5 e7f7 e3e4 f7e7 e5d5
info depth 38 seldepth 40 score cp 310 ebf 1.48 time 14054 nodes 25481083 pv e1d2 e8d7 d2e3 d7e6 e3d4 e6d6 e2e3 d6e6 d4e4 e6d6 e4f5 d6e7 f5e5 e7f7 e3e4 f7e7
info depth 39 seldepth 41 score cp 505 ebf 1.12 time 17215 nodes 31186369 pv e1d2
info depth 39 seldepth 41 score cp 505 ebf 2.98 time 61784 nodes 91299844 pv e1d2
info depth 40 seldepth 42 score cp 957 ebf 0.98 time 64792 nodes 96741544 pv e1d2
info depth 40 seldepth 42 score cp 957 ebf 1.71 time 201822 nodes 271889546 pv e1d2
info depth 41 seldepth 43 score cp 540 ebf 2.27 time 217866 nodes 299841369 pv e1d2
info score cp 540
bestmove e1d2
As far as I can tell, the promotion is 27 plies away from the root. It's a mate in 22 from the initial position. So you certainly shouldn't expect to find the promotion at depth 11, unless your engine has special KPK knowledge. The King, for example, gives a +7.5 score at depth 4. :D

Myrddin finds it at depth 25.
tttony
Posts: 268
Joined: Sun Apr 24, 2011 12:33 am

Re: Problems with TT, sometimes makes blunder moves

Post by tttony »

PK wrote:Another classic way to break transposition table is to save moves and scores when search is already timed-out.

If the error disappears when you run your engine in fixed depth mode, then this is the reason.
In the begining of the search I check for timout:

Code: Select all

int search(...) {

if (!inCheck && depth <= 0&#41; &#123;
	return qsearch&#40;alpha, beta, board, params, pv&#41;;
&#125;

CheckInputAndTime&#40;params&#41;;
if &#40;params->stop&#41; 
	return 0;

...
And after getting score

Code: Select all

score = -search&#40;-beta, -alpha, depth - 1, board, params, givesCheck, new_pv&#41;;

UnmakeMove&#40;board&#41;;

if &#40;params->stop&#41;
	return 0;
I don't think that is the problem, because when analysing, makes blunder moves, with the HGM position it's taking too much time

I have modified the PST for pawns and kings and added material draw to see if that could be the problem but keeps blundering....

Code: Select all

FEN&#58; 4k3/8/8/8/8/8/4P3/4K3 w - - 0 1 

Skiull 0.2 x64 popcnt&#58;
   1	00&#58;00	           7	7	+1,19	Ke1-d2
   2	00&#58;00	          24	24	+0,99	Ke1-d2 Ke8-d7
   3	00&#58;00	         100	100	+1,29	Ke1-d2 Ke8-d7 Kd2-d3
   4	00&#58;00	         248	248	+0,99	Ke1-d2 Ke8-d7 Kd2-d3 Kd7-d6
   5	00&#58;00	         672	672	+1,09	Ke1-d2 Ke8-d7 Kd2-d3 Kd7-d6 e2-e4
   6	00&#58;00	       1.442	1.442	+1,09	Ke1-d2 Ke8-d7 Kd2-d3 Kd7-d6 Kd3-d4 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8
This is the new PST for pawns:

BLACK = 0
WHITE = 0

Code: Select all

const int16_t PawnTable&#91;2&#93;&#91;64&#93; = &#123;
	&#123;
		0, 0, 0, 0, 0, 0, 0, 0,
		7, 11, 23, 39, 39, 23, 11, 7,
		-5, 1, 14, 29, 29, 14, 1, -5,
		-14, -8, 6, 17, 17, 6, -8, -14,
		-21, -16, -1, 9, 9, -1, -16, -21,
		-21, -16, -6, 4, 4, -6, -16, -21,
		-21, -16, -6, -1, -1, -6, -16, -21,
		0, 0, 0, 0, 0, 0, 0, 0
	&#125;,
	&#123; 
		0, 0, 0, 0, 0, 0, 0, 0,
		-21, -16, -6, -1, -1, -6, -16, -21,
		-21, -16, -6, 4, 4, -6, -16, -21,
		-21, -16, -1, 9, 9, -1, -16, -21,
		-14, -8, 6, 17, 17, 6, -8, -14,
		-5, 1, 14, 29, 29, 14, 1, -5,
		7, 11, 23, 39, 39, 23, 11, 7,
		0, 0, 0, 0, 0, 0, 0, 0 
	&#125;
&#125;;
Kings:

Code: Select all

const int16_t KingEG&#91;2&#93;&#91;64&#93; = &#123;
	&#123;
		-10, 10, 15, 20, 20, 15, 10, -10,
		0, 20, 35, 45, 45, 35, 20, 0,
		10, 25, 40, 50, 50, 40, 25, 10,
		10, 25, 40, 50, 50, 40, 25, 10,
		10, 25, 40, 50, 50, 40, 25, 10,
		0, 15, 30, 40, 40, 30, 15, 0,
		-15, -10, 0, 10, 10, 0, -10, -15,
		-30, -25, -15, -10, -10, -15, -25, -30,
	&#125;,
	&#123; 
		-30, -25, -15, -10, -10, -15, -25, -30,
		-15, -10, 0, 10, 10, 0, -10, -15,
		0, 15, 30, 40, 40, 30, 15, 0,
		10, 25, 40, 50, 50, 40, 25, 10,
		10, 25, 40, 50, 50, 40, 25, 10,
		10, 25, 40, 50, 50, 40, 25, 10,
		0, 20, 35, 45, 45, 35, 20, 0,
		-10, 10, 15, 20, 20, 15, 10, -10 
	&#125;
&#125;;

const int16_t KingMG&#91;2&#93;&#91;64&#93; = &#123;
	&#123;
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-50, -50, -50, -50, -50, -50, -50, -50,
		-30, -30, -30, -30, -30, -30, -30, -30,
		0, 5, 5, -10, -10, 0, 10, 5,
	&#125;,
	&#123;
		0, 5, 5, -10, -10, 0, 10, 5,
		-30, -30, -30, -30, -30, -30, -30, -30,
		-50, -50, -50, -50, -50, -50, -50, -50,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70,
		-70, -70, -70, -70, -70, -70, -70, -70
	&#125;
&#125;;
To know if it's endgame I have this (same as Vice)

Code: Select all

#define ENDGAME_MAT &#40;1 * PieceValue&#40;WHITE_ROOK&#41; + 2 * PieceValue&#40;WHITE_KNIGHT&#41; + 2 * PieceValue&#40;WHITE_PAWN&#41; + PieceValue&#40;WHITE_KING&#41;)
I'm starting to think that the problem could be the eval function, it's too basic
Dann Corbit
Posts: 12537
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Problems with TT, sometimes makes blunder moves

Post by Dann Corbit »

tttony wrote: {snippity-snip}
I'm starting to think that the problem could be the eval function, it's too basic
Nope.
It would play the same with and without the hash if the problem was eval.
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.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problems with TT, sometimes makes blunder moves

Post by Sven »

Dann Corbit wrote:
tttony wrote: {snippity-snip}
I'm starting to think that the problem could be the eval function, it's too basic
Nope.
It would play the same with and without the hash if the problem was eval.
@Tony:

The problem is in at least two places in the hash table code.

1) tt_init():

Code: Select all

uint32_t t = 2;
for (; t <= size; t *= 2&#41;
    ;
// Cast to uint64_t because gives = 0
uint64_t ttsize = ((&#40;uint64_t&#41;t / 2&#41; << 20&#41;;
This calculation is wrong. Simply remove the "<< 20" part.

2) index calculation by using bitwise AND (at 3 places):

Code: Select all

uint64_t index = key & hash->size;
After correcting issue 1) above this will work "somehow" but it drops the lowest two bits from the index due to the statement

Code: Select all

hash->size = ttsize - 4;
in tt_init() which seems to increase the probability of hash collisions if I understood it right. Why is that necessary? Why not "hash->size = ttsize - 1" ?

EDIT: 3) Please check the value of MAX_MATE_EVAL. It is used for transforming mate scores from/to TT but then its value should be the biggest possible value that can be returned by the evaluation function (the name MAX_MATE_EVAL could be understood different, though). This would not cause the big problems you were describing but could be another small source of trouble.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problems with TT, sometimes makes blunder moves

Post by Sven »

Sven Schüle wrote:
Dann Corbit wrote:
tttony wrote: {snippity-snip}
I'm starting to think that the problem could be the eval function, it's too basic
Nope.
It would play the same with and without the hash if the problem was eval.
@Tony:

The problem is in at least two places in the hash table code.

1) tt_init():

Code: Select all

uint32_t t = 2;
for (; t <= size; t *= 2&#41;
    ;
// Cast to uint64_t because gives = 0
uint64_t ttsize = ((&#40;uint64_t&#41;t / 2&#41; << 20&#41;;
This calculation is wrong. Simply remove the "<< 20" part.
15 minutes have passed so I can't edit any longer ... Your calculation is right if "size" is given in MB :-)