Page 1 of 1

Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 6:26 pm
by silentshark
Hi all,

Just looking at my code again, and I like to do null moves whenever possible. But I'm aware many engines only attempt null move when the score is above beta.

How much of a win is only doing null moves when score >= beta?

My testing, in my program, shows it makes practically no difference.

What have others found?

Re: Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 7:07 pm
by odomobo
I haven't implemented null move pruning, but theoretically...

Pruning when score == beta should only fail for the same case as pruning when score > beta -- when the side to move is in zugzwang. Pruning for score >= beta should be strictly better, unless there is some other bug with your null pruning code. If you see very little impact from this change, then I suspect the case of null move pruning where score is exactly == beta is just rare.

Re: Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 7:24 pm
by hgm
But I suppose he refers to the case score < beta.

Re: Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 8:35 pm
by silentshark
hgm wrote: Fri Jan 25, 2019 7:24 pm But I suppose he refers to the case score < beta.
Indeed. What is the ELO loss for doing null move when score < beta vs only doing when score >= beta?

Re: Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 10:12 pm
by jorose
There is only one way to find out. You make the change and measure the difference. Iirc in Winter it was below the threshold I could actually measure with my resources at the time, meaning it was single digit. Every engine is different though. It's quite possible the condition should not be added in your program at all.

Re: Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 11:11 pm
by silentshark
jorose wrote: Fri Jan 25, 2019 10:12 pm There is only one way to find out. You make the change and measure the difference. Iirc in Winter it was below the threshold I could actually measure with my resources at the time, meaning it was single digit. Every engine is different though. It's quite possible the condition should not be added in your program at all.
..and that is what I am doing. So far, only considering nullmove when score>=beta is giving about +4 ELO, after 3600 games. So not a big deal, I think :-)

Re: Null move pruning, only when score >= beta?

Posted: Fri Jan 25, 2019 11:45 pm
by odomobo
Wait, I think I am misunderstanding you. When you say "score", do you mean the static evaluation of the current position?

Re: Null move pruning, only when score >= beta?

Posted: Sat Jan 26, 2019 9:02 am
by silentshark
odomobo wrote: Fri Jan 25, 2019 11:45 pm Wait, I think I am misunderstanding you. When you say "score", do you mean the static evaluation of the current position?
Yes, static eval of current position (material + positional score)

Re: Null move pruning, only when score >= beta?

Posted: Sat Jan 26, 2019 12:32 pm
by elcabesa
probably when you have a static evaluation below beta and you give the opponent a free move, it's very difficult that you can have a beta cutoff, but also it will add very few node to verify that the result is below beta, so it make very small difference.

you can see "null move pruning" as : if my situation is so good that giving a free move to my opponent I still have the advantage, so I bet that I could say this is a good position.
Or if you look it from the previous move (opponent): if I have done a very bad move that even if I was given another free move I could not recover, the the move is with good probability bad.

removing "score >=beta" from the test you are removing the assertion that "your situation is so good" from the test.