Page 1 of 2

Why not two consecutive null moves ?

Posted: Thu May 07, 2015 4:52 pm
by Henk
Can someone explain what is wrong with null move (R) followed by null move (R) of the opponent in a path of the search tree where null move(R) is a null move reduction.

Re: Why not two consecutive null moves ?

Posted: Thu May 07, 2015 5:39 pm
by hgm
Nothing, really. Some claim it is even favorable. It might help you to spot zugzwangs (but only if you limit the number of consecutive null moves to two).

Re: Why not two consecutive null moves ?

Posted: Thu May 07, 2015 6:39 pm
by mvk

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 9:34 am
by Henk
How many real plies does a null move reduction need to make it work correctly ? For instance do I need to test depth >= R + 2 if Null move reduction reduces with R. (My null move reduction does not reduce with R + 1)

Code: Select all

 if &#40;depth >= R + 2 && depth < pos.MaxDepth&#41;
 &#123;
        if &#40;NullMoveCutOff&#40;entry, depth, ub, out nullMoveValue&#41;)
        &#123;
             bestMove = null;
             return nullMoveValue;
        &#125;

 &#125;

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 10:29 am
by Dann Corbit
Henk wrote:How many real plies does a null move reduction need to make it work correctly ? For instance do I need to test depth >= R + 2 if Null move reduction reduces with R. (My null move reduction does not reduce with R + 1)

Code: Select all

 if &#40;depth >= R + 2 && depth < pos.MaxDepth&#41;
 &#123;
        if &#40;NullMoveCutOff&#40;entry, depth, ub, out nullMoveValue&#41;)
        &#123;
             bestMove = null;
             return nullMoveValue;
        &#125;

 &#125;
Every engine works differently.
Ernst Heinz championed adaptive null move pruning. This is the basic idea that is best. How to adapt and how much to adapt is a very interesting question.

I would suggest for starters to go here:
https://chessprogramming.wikispaces.com ... te_note-10
and read the ps file from E. Heinz.

The adaptive null move pruning in stockfish is especially clever and well done, due to Marco's brilliance. But it is very complicated so I would start simple at first. After you have got it working right, then expand your experiments. The best rule of thumb is, first make it correct, and then improve it.

What works well in someone else's engine may not work at all in yours. You have to try different things to discover the right answers for your program.

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 11:19 am
by hgm
I use null move even at d=1 (if eval >= beta). Of course there is nothing to reduce in that case. Perhaps it would be better to sort it behind the good captures in that case, but I never tried that. It seemed to me a null move would have better chances to be good than a randomly picked non-capture. If the previous ply was a specific threat, history would not be any help picking the correct evasion if a withdrawal is called for, and if there was no threat the null move guarantees you don't create one against you.

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 11:42 am
by op12no2
FWIW one thing I fell into was forgetting to change the horizon detection to <= 0 when using null move R values > 1 at all +ve depths. CPW 1.1 engine uses == 0 and it works because of how they do it; but it's scary nonetheless to me :)

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 11:43 am
by Henk
At low depths there are not many plies to verify if a null move is ok. So reductions or pruning at these lower depth is too risky. Maybe I can use null move only for check or a heavy thread detection. Also null moves fail high detection is costly it is doesn't fail high.

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 11:59 am
by hgm
The point is that at low depth real moves also don't have enough plies left to verify whether they really fail high or not. And that in general the real moves need more plies to do such a verification with the same confidence. As these can be a delaying tactic that the opponent cannot ignore, like first trading Queens, or attacking a Queen with a Knight. Null move can never be a delaying tactic, and this is why you can trust a null move that seems OK at depth d-R more than a real move that seems OK at depth d. Especially since even when it would turn out it missed a deeper problem, with null move you would still have an extra move 'up your sleeve' that you could use to preemptively defend against the threat, while with real moves you would have to replace one of your moves for that, which then might cause other problems.

Re: Why not two consecutive null moves ?

Posted: Fri May 08, 2015 12:03 pm
by Dann Corbit
Henk wrote:At low depths there are not many plies to verify if a null move is ok. So reductions or pruning at these lower depth is too risky. Maybe I can use null move only for check or a heavy thread detection. Also null moves fail high detection is costly it is doesn't fail high.
When there are a lot of chessmen on the board, null move is pretty safe.
You will notice in Stockfish when they do the verify, it is at a greatly reduced depth.

When the board gets really sparse, then null move becomes more and more dangerous.

Vincent's double null trick is safe, quick, and works really well. Turn null move reduction off completely when all the pieces are gone. Also, don't use it when you are in check.

Null move reduction is a stupendous benefit. Every strong program does it (or something very similar).