Null move pruning, only when score >= beta?

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
User avatar
silentshark
Posts: 233
Joined: Sat Mar 27, 2010 6:15 pm
Contact:

Null move pruning, only when score >= beta?

Post by silentshark » Fri Jan 25, 2019 5:26 pm

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: 59
Joined: Thu Jul 05, 2018 11:09 pm
Location: Chicago, IL
Full name: Josh Odom

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

Post by odomobo » Fri Jan 25, 2019 6:07 pm

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: 23617
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

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

Post by hgm » Fri Jan 25, 2019 6:24 pm

But I suppose he refers to the case score < beta.

User avatar
silentshark
Posts: 233
Joined: Sat Mar 27, 2010 6:15 pm
Contact:

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

Post by silentshark » Fri Jan 25, 2019 7:35 pm

hgm wrote:
Fri Jan 25, 2019 6: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: 261
Joined: Thu Jan 22, 2015 2:21 pm
Location: Zurich, Switzerland
Full name: Jonathan Rosenthal

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

Post by jorose » Fri Jan 25, 2019 9: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.
-Jonathan

User avatar
silentshark
Posts: 233
Joined: Sat Mar 27, 2010 6:15 pm
Contact:

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

Post by silentshark » Fri Jan 25, 2019 10:11 pm

jorose wrote:
Fri Jan 25, 2019 9: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: 59
Joined: Thu Jul 05, 2018 11:09 pm
Location: Chicago, IL
Full name: Josh Odom

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

Post by odomobo » Fri Jan 25, 2019 10:45 pm

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: 233
Joined: Sat Mar 27, 2010 6:15 pm
Contact:

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

Post by silentshark » Sat Jan 26, 2019 8:02 am

odomobo wrote:
Fri Jan 25, 2019 10: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: 806
Joined: Sun May 23, 2010 11:32 am
Contact:

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

Post by elcabesa » Sat Jan 26, 2019 11:32 am

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.

Post Reply