Null move pruning, only when score >= beta?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

Null move pruning, only when score >= beta?

Post 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?
odomobo
Posts: 96
Joined: Fri Jul 06, 2018 1:09 am
Location: Chicago, IL
Full name: Josh Odom

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

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

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

Post by hgm »

But I suppose he refers to the case score < beta.
User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

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

Post 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?
jorose
Posts: 358
Joined: Thu Jan 22, 2015 3:21 pm
Location: Zurich, Switzerland
Full name: Jonathan Rosenthal

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

Post 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.
-Jonathan
User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

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

Post 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 :-)
odomobo
Posts: 96
Joined: Fri Jul 06, 2018 1:09 am
Location: Chicago, IL
Full name: Josh Odom

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

Post by odomobo »

Wait, I think I am misunderstanding you. When you say "score", do you mean the static evaluation of the current position?
User avatar
silentshark
Posts: 327
Joined: Sat Mar 27, 2010 7:15 pm

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

Post 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)
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

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

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