Why not two consecutive null moves ?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Why not two consecutive null moves ?

Post 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.
User avatar
hgm
Posts: 27793
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Why not two consecutive null moves ?

Post 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).
mvk
Posts: 589
Joined: Tue Jun 04, 2013 10:15 pm

Re: Why not two consecutive null moves ?

Post by mvk »

[Account deleted]
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Why not two consecutive null moves ?

Post 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;
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Why not two consecutive null moves ?

Post 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.
User avatar
hgm
Posts: 27793
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Why not two consecutive null moves ?

Post 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.
op12no2
Posts: 490
Joined: Tue Feb 04, 2014 12:25 pm
Full name: Colin Jenkins

Re: Why not two consecutive null moves ?

Post 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 :)
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Why not two consecutive null moves ?

Post 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.
User avatar
hgm
Posts: 27793
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Why not two consecutive null moves ?

Post 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.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Why not two consecutive null moves ?

Post 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).