14. Nd5!!

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Re: 14. Nd5!!

Post by royb »

Jack Lad wrote:[d] rn1r2k1/1bqpbppp/pp2pn2/6N1/2P5/1PN1P3/PBQ1BPPP/3R1RK1 w - - 6 14

Betcha your engine won't dare to play it! :twisted:
I ran it through my tweaked Glaurung 2.2 32-bit and it spots Nd5 very quickly indeed (less than 2 secs) on a 1.67 GHz (i.e slow) computer:

2 +2.00 14.Na4 e5 (0.24)
2 +2.21 14.Bh5 Nxh5 15.Qxh7+ Kf8 16.Qxh5 Bxg5 17.Qxg5 (0.25)
3 +1.45 14.Bh5 g6 15.Bf3 Bxf3 16.gxf3 (0.25)
3 +2.52 14.Na4 h6 15.Bxf6 Bxf6 (0.26)
4 +1.13 14.Na4 h6 15.Bxf6 Bxf6 16.Qh7+ Kf8 17.Ne4 Bxe4 18.Qxe4 (0.26)
4 +1.86 14.Nb1 g6 15.Nd2 e5 (0.26)
5 +1.64 14.Nb1 e5 15.f4 Qc6 16.Bf3 (0.27)
6 +1.66 14.Nb1 e5 15.Qf5 Nc6 16.Bd3 g6 (0.29)
7 +1.43 14.Nb1 g6 15.Nd2 Nc6 16.Bf3 e5 17.Rfe1 (0.32)
7 +2.13 14.Na4 e5 15.f4 e4 16.Bxf6 Bxf6 17.Nxe4 Bxe4 18.Qxe4 (0.36)
8 +2.01 14.Na4 e5 15.f4 e4 16.Bd4 b5 17.Be5 d6 (0.40)
9 +2.19 14.Na4 e5 15.f4 Qc6 16.Bf3 e4 17.Bxf6 Qxf6 18.Nxe4 Qe6 (0.54)
10 +1.66 14.Na4 g6 15.Bd4 Nd5 16.Nf3 b5 17.Nc3 Nb4 18.Qb1 N8c6 (1.06)
10 +3.37 14.Nd5 exd5 15.Bxf6 Bxf6 16.Qxh7+ Kf8 17.Bh5 Bxg5 18.Qh8+ Ke7 19.Qxg7 Rf8 20.Qxg5+ Ke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f4 Nd7 24.Qxd6 Qe7 25.Qe6 Qxe6 26.dxe6 (63.48)
User avatar
Eelco de Groot
Posts: 4567
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: 14. Nd5!!

Post by Eelco de Groot »

I think Blueberry would win it on plydepth, as it only needs 4 plies. Unfortunately because of the horizon extensions which, as the name implies, are designed to look over the event horizon at plydepth = 0 where the quiescence search starts, this still takes 2 minutes and 12 seconds. Basically the idea with horizon extensions was to extend multiple 1 ply searches so it behaves a little like a Monte Carlo search, but because q-search and IID searches are now also invoked with up to seven plies deep searches when the eval is going up, AND, if the search from best_move is going down instead of up, I also extend every nextbest_move, the idea is a bit lost. This really becomes too costly even in a 4 ply deep search, a one ply search is something very different from a 7 ply search after all.

When I bypass all horizon extensions I get a better result:

[D]rn1r2k1/1bqpbppp/pp2pn2/6N1/2P5/1PN1P3/PBQ1BPPP/3R1RK1 w - -

Engine: Blueberry Beta 4 DM70 Build 370 (256 MB)
by F. Letouzey, T. Gaksch, E. de Groot

2/14 0:00 +0.41 1.Nce4 Nxe4 2.Nxe4 f5 (3.033)

2/26 0:00 +0.43 1.Na4 h6 2.Bxf6 Bxf6 3.Qh7+ Kf8
4.Nh3 g6 5.Qxh6+ Kg8 (117.220)

2/26 0:00 +0.42 1.Na4 h6 2.Nh3 Nc6 3.Nc5 bxc5 (140.067)

2/29 0:00 +0.67 1.Na4 h6 2.Bxf6 Bxf6 3.Qh7+ Kf8
4.Ne4 Bxe4 5.Qxe4 Nc6 6.Qh7 Ne7
7.Qh8+ Ng8 (290.331)

3/29 0:00 +1.17 1.Na4 e5 2.f4 Nc6 3.Bd3 (422.787)

4/35 0:01 +0.44 1.Na4 h6 2.Bxf6 Bxf6 3.Qh7+ Kf8
4.Ne4 Bxe4 5.Qxe4 (699.036) 543

4/42 0:05 +1.24 1.Nd5 exd5 2.Bxf6 Bxf6 3.Qxh7+ Kf8
4.cxd5 Be5 5.Rc1 Bxh2+ 6.Qxh2 Qxh2+
7.Kxh2 f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13.Qxe7+ Kxe7 14.Rc7+ (2.803.164.679) 551

18/80 107:40 +2.77 1.Nd5 exd5 2.Bxf6 Bxf6 3.Qxh7+ Kf8
4.cxd5 d6 5.Bh5 Bxg5 6.Qh8+ Ke7
7.Qxg7 Rf8 8.Qxg5+ Ke8 9.Rd4 Qe7
10.Qf5 Nd7 11.Re4 Ne5 12.Rb4 (3.479.502.463) 538

19/80 116:33 +2.73 1.Nd5 exd5 2.Bxf6 Bxf6 3.Qxh7+ Kf8
4.cxd5 d6 5.Bh5 Bxg5 6.Qh8+ Ke7
7.Qxg7 Rf8 8.Qxg5+ Ke8 9.Rd4 Qe7
10.Qf5 Nd7 11.Re4 Ne5 12.f4 Bxd5
13.fxe5 Bxe4 14.Qxe4 (3.790.635.648) 542


best move: Nc3-d5 time: 122:52.031 min n/s: 543.727 CPU 100.0% n/s(1CPU): 543.727 nodes: 4.008.270.000


Maybe I should not post the code for the horizon extensions because in the present form they are clearly not working and the design is very crude. But who knows it may help to think about better ways of doing something similar and it is of course very easy to scale everything down again so that the impact is just limited and, in a limited form, who knows not such a drain on the search.

Code: Select all

// [EdG: horizon extensions hack]

   if &#40;node_type == NodePV && height <= SearchCurrent&#91;ThreadId&#93;->act_iteration + 10&#41; sharpen_PV = true;
   else sharpen_PV = false;

   if &#40;depth == 1 && best_move != MoveNone && nextbest_value != ValueNone && depth_best_move < depth
	   && !Singular_Extended && best_value < beta && best_value >= alpha - 50 && &#40;extended || sharpen_PV&#41; &&
	   height >= SearchCurrent&#91;ThreadId&#93;->act_iteration + 3 /*&& nextbest_value <= alpha - 100*/) &#123;

      move_do&#40;board,best_move,undo&#41;;
	  old_value = best_value;
	  best_value = -full_search&#40;board,-&#40;alpha + 51&#41;,-&#40;alpha + 50&#41;,depth_best_move + 1,height+1,new_pv,NodeCut,true,false,ThreadId&#41;;
	  best_value = -full_search&#40;board,-&#40;alpha + 51&#41;,-&#40;alpha + 50&#41;,depth_best_move + 2,height+1,new_pv,NodeCut,true,false,ThreadId&#41;;
	  if &#40;best_value >= old_value - 50 || sharpen_PV&#41; &#123;
		 old_value = best_value;
		 best_value = -full_search&#40;board,-&#40;alpha + 51&#41;,-&#40;alpha + 50&#41;,depth_best_move + 3,height+1,new_pv,NodeCut,true,false,ThreadId&#41;;
		 if &#40;best_value > old_value - 50&#41; &#123;
			best_value = -full_search&#40;board,-&#40;best_value + 1&#41;,-&#40;best_value&#41;,depth_best_move + 4,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			best_value = -full_search&#40;board,-&#40;best_value + 1&#41;,-&#40;best_value&#41;,depth_best_move + 5,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			best_value = -full_search&#40;board,-&#40;best_value + 1&#41;,-&#40;best_value&#41;,depth_best_move + 6,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			old_value = best_value;
            best_value = -full_search&#40;board,-&#40;best_value + 1&#41;,-&#40;best_value&#41;,depth_best_move + 7,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			if &#40;best_value > old_value - 50&#41; &#123;
			   old_value = best_value;
			   best_value = -full_search&#40;board,-beta,-alpha,depth_best_move + 5,height+1,new_pv,NodePV,true,false,ThreadId&#41;;
			   if &#40;best_value > old_value && best_value < beta && height < SearchCurrent&#91;ThreadId&#93;->act_iteration + 20&#41;&#123;
			      old_value = best_value;
			      best_value = -full_search&#40;board,-beta,-alpha,depth_best_move + 6,height+1,new_pv,NodePV,true,false,ThreadId&#41;;
			      if &#40;best_value > old_value && best_value < beta && height < SearchCurrent&#91;ThreadId&#93;->act_iteration + 20&#41;
			         best_value = -full_search&#40;board,-beta,-alpha,depth_best_move + 7,height+1,new_pv,NodePV,true,false,ThreadId&#41;;
			   &#125;
			&#125;
		 &#125;
	  &#125;
	  move_undo&#40;board,best_move,undo&#41;;
      pv_cat&#40;pv,new_pv,best_move&#41;;
   
	  ASSERT&#40;value_is_ok&#40;best_value&#41;);

      if &#40;best_value > alpha&#41; &#123;
          alpha = best_value;
	  &#125;
	  if &#40;best_value <= nextbest_value&#41; &#123;
		 move_do&#40;board,nextbest_move,undo&#41;;
		 old_value = nextbest_value;
		 nextbest_value = -full_search&#40;board,-&#40;alpha + 51&#41;,-&#40;alpha + 50&#41;,depth_best_move + 1,height+1,new_pv,NodeCut,true,false,ThreadId&#41;;
	     if &#40;nextbest_value >= old_value - 50 || sharpen_PV&#41; &#123;
			old_value = nextbest_value;
		    nextbest_value = -full_search&#40;board,-&#40;alpha + 51&#41;,-&#40;alpha + 50&#41;,depth_best_move + 2,height+1,new_pv,NodeCut,true,false,ThreadId&#41;;
		    if &#40;nextbest_value > old_value - 50&#41; &#123;
			   nextbest_value = -full_search&#40;board,-&#40;nextbest_value + 1&#41;,-&#40;nextbest_value&#41;,depth_best_move + 3,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			   nextbest_value = -full_search&#40;board,-&#40;nextbest_value + 1&#41;,-&#40;nextbest_value&#41;,depth_best_move + 4,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			   nextbest_value = -full_search&#40;board,-&#40;nextbest_value + 1&#41;,-&#40;nextbest_value&#41;,depth_best_move + 5,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
               nextbest_value = -full_search&#40;board,-&#40;nextbest_value + 1&#41;,-&#40;nextbest_value&#41;,depth_best_move + 6,height+1,new_pv,NodeCut,true,true,ThreadId&#41;;
			   old_value = nextbest_value;
			   nextbest_value = -full_search&#40;board,-beta,-alpha,depth_best_move + 4,height+1,new_pv,NodePV,true,false,ThreadId&#41;;
			   if &#40;nextbest_value > old_value && nextbest_value < beta && height < SearchCurrent&#91;ThreadId&#93;->act_iteration + 25&#41;&#123;
			      old_value = nextbest_value;
			      nextbest_value = -full_search&#40;board,-beta,-alpha,depth_best_move + 5,height+1,new_pv,NodePV,true,false,ThreadId&#41;;
			      if &#40;nextbest_value > old_value && nextbest_value < beta && height < SearchCurrent&#91;ThreadId&#93;->act_iteration + 25&#41;
			         nextbest_value = -full_search&#40;board,-beta,-alpha,depth_best_move + 6,height+1,new_pv,NodePV,true,false,ThreadId&#41;;
			   &#125;
		    &#125;
	     &#125;
		 move_undo&#40;board,nextbest_move,undo&#41;;
		 if &#40;nextbest_value > best_value&#41;&#123;
            best_value = nextbest_value;
            pv_cat&#40;pv,new_pv,nextbest_move&#41;;
   
			ASSERT&#40;value_is_ok&#40;best_value&#41;);

            if &#40;best_value > alpha&#41; &#123;
               alpha = best_value;
            &#125;
		 &#125;
	  &#125;
   &#125; // end of horizon extensions

You can clearly see the extended searches going to seven plies over depth_best_move which is usually zero, or q-search only, as we are at depth == one. Sharpen_PV I borrowed from HIARCS but it is just the name of a yes or no variable here. The second block is to extend nextbest_move.

At the moment in build 370 the block above is bypassed by

Code: Select all

.
.
   &#125; // end of single reply extensions
   
   goto cut; // Bypassing horizon extensions in this version

   // &#91;EdG&#58; horizon extensions hack&#93;
.
. 

I have to rethink this whole structure.

Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: 14. Nd5!!

Post by bob »

Tord Romstad wrote:
bob wrote:

Code: Select all

              time=1&#58;47  mat=0  n=2006206447  fh=90%  nps=18.7M
18.7 *million* nodes per second? Wow, that's almost sixteen hundred times faster than Glaurung for this position. :)

What hardware did you use?

Tord
It is the 2-year old dual quad-core xeon box I have been using. 2.33ghz processors. Same box used in last couple of CCts and the ACCA events... One node of the big 70 node cluster.
Jack Lad
Posts: 8557
Joined: Wed Mar 08, 2006 10:01 pm
Location: UK

Re: 14. Nd5!!

Post by Jack Lad »

Eelco de Groot wrote:19/80 116:33 +2.73 1.Nd5 exd5 2.Bxf6 Bxf6 3.Qxh7+ Kf8
4.cxd5 d6 5.Bh5 Bxg5 6.Qh8+ Ke7
7.Qxg7 Rf8 8.Qxg5+ Ke8 9.Rd4 Qe7
10.Qf5 Nd7 11.Re4 Ne5 12.f4 Bxd5
13.fxe5 Bxe4 14.Qxe4 (3.790.635.648) 542[/b][/color]

best move: Nc3-d5 time: 122:52.031 min n/s: 543.727 CPU 100.0% n/s(1CPU): 543.727 nodes: 4.008.270.000
Congratulations Eelco - your engine was the only one to find the correct winning line! 8-) 22.Rc1? is no good.
[d] rn2kr2/1bq2p2/pp1p4/3P2QB/8/1P2P3/P4PPP/3R1RK1 w - - 1 22
24.Re4 Ne5 25.f4 Bxd5 26.fxe5 Bxe4 27.Qxe4 Rc8
[d] 2r1kr2/4qp2/pp1p4/4P2B/4Q3/1P2P3/P5PP/5RK1 w - - 1 28
28.e6 or Qa4+ both win.
Now cracks a noble heart.—Good night, sweet Princess, And flights of angels sing thee to thy rest!