NULL Move code question

Code, algorithms, languages, construction...

NULL Move code question

Postby thevinenator » Fri Jan 27, 2017 5:49 pm

Consider the CPW code for NULL Move...

Code: Select all
   if (depth > 2
      &&   can_null
      &&  !is_pv
      &&   eval(alpha, beta, 1) > beta
      &&   b.piece_material[b.stm] > e.ENDGAME_MAT
      &&  !flagInCheck)
   {
      char ep_old = b.ep;
      move_makeNull();

      /**********************************************************************
      *  We use so-called adaptative null move pruning. Size of reduction   *
      *  depends on remaining  depth.                                       *
      **********************************************************************/
      char R = 2;
      if (depth > 6) R = 3;

      val = -Search(depth - R - 1, ply + 1, -beta, -beta + 1, NO_NULL, NO_PV);

      move_unmakeNull(ep_old);

      if (time_over) return 0;
      if (val >= beta) return beta;
   }   // end of null move code


I'm questioning the first condition (depth > 2)....

When the call to Search is made, the depth passed to the search will have the following values, based on the original depth.

Org Depth Search Depth
0 n/a
1 n/a
2 n/a
3 0
4 1
5 2
6 3
7 3

Consider org depth of 3. search() will be called with an effective depth of 0 and will drop into QSearch() (in my implementation unless there is a depth extension) and won't do any further search. is that really part of the idea of the Null Move ? Seems to me the threshold for dropping into search() should only occur if a another recursive call to search() can be made.

Is this how others implement it?
"An Engine's strength flows from the Search. But beware, pruning, extensions, reductions; the dark side of the Search are they. Once you start down the dark path, it will dominate and consume you, as it has to so many developers before.” -- Yoda
thevinenator
 
Posts: 65
Joined: Tue Jun 02, 2015 11:02 pm

Re: NULL Move code question

Postby H.G.Muller » Fri Jan 27, 2017 6:02 pm

I always use the condition depth > 0. I.e. I don't do null move in QS (d <= 0), but do it for any higher depth. At d=1, 2 and 3 the reply is QS. If the null move fails high at d=3, (meaning that in QS the opponent could not grab enough material to worry me), I should not expect the d=3 search of my best real move to fail low. Because even if the opponent could set up something that would pay off on ply 4 (his first QS ply), I will almost always be able to prevent that with my move at ply 1 (which I can freely use, as there was no immediate threat). So doing a d=3 search is a waste of time.
H.G.Muller
 
Posts: 171
Joined: Sun Jul 14, 2013 10:00 am

Re: NULL Move code question

Postby pkumar » Wed Feb 08, 2017 5:43 pm

H.G.Muller wrote:I always use the condition depth > 0. I.e. I don't do null move in QS (d <= 0), but do it for any higher depth. At d=1, 2 and 3 the reply is QS.

This is reasonable. I wonder why the cpw code in the original post uses the condition depth>2 .
pkumar
 
Posts: 2
Joined: Thu Jul 31, 2014 6:09 pm


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron