Should null moves be applied more than once in the same search tree?

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
eboatwright
Posts: 41
Joined: Tue Jan 09, 2024 8:38 pm
Full name: E Boatwright

Should null moves be applied more than once in the same search tree?

Post by eboatwright »

Hello,

I've had Null Move Pruning in my engine for a while now, but I only just had the thought of whether or not I should allow more than one in the same search tree.
I'm running tests, but the results are dubious so far: ~+10 wins after 400 games (or +10 Elo +/- 25) so I wanted to ask if anybody else has experimented with this, and what the pros and cons might be?

Thanks in advance!
Creator of Maxwell
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Should null moves be applied more than once in the same search tree?

Post by mvanthoor »

It can be applied multiple times in the same search tree if the conditions for the null move are met, but you must take care to not make a series of null moves one after another, or your search will either become unpredictable or stall. See Restrictions on use. Make sure to avoid applying a null move in those situations.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
eboatwright
Posts: 41
Joined: Tue Jan 09, 2024 8:38 pm
Full name: E Boatwright

Re: Should null moves be applied more than once in the same search tree?

Post by eboatwright »

mvanthoor wrote: Mon Jan 29, 2024 10:52 pm It can be applied multiple times in the same search tree if the conditions for the null move are met, but you must take care to not make a series of null moves one after another, or your search will either become unpredictable or stall. See Restrictions on use. Make sure to avoid applying a null move in those situations.
Ok thanks!
This is my current condition check, I'm pretty sure I covered all the bases, but feel free to let me know if I missed something :D

Code: Select all

if not_pv
&& depth > 2
&& board.total_material_without_pawns > 0
&& !board.king_in_check(board.white_to_move)
&& board.get_last_move().capture == NO_PIECE
&& board.evaluate() >= beta
&& board.try_null_move() { // Returns false if the last move was a null move, and true if the null move was successful
	// Do null move prune
}
Creator of Maxwell