Null move pruning

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
cms271828
Posts: 316
Joined: Wed Apr 12, 2006 10:47 pm

Null move pruning

Post by cms271828 »

Hi,

I don't know anything about null move pruning, but I know someone using verified null move pruning (using reduction depth 3, then verifying it with normal null move pruning).
I'm using hash tables, and QS, so would like to get the search depth a bit deeper with null move pruning, but I don't which version to use.

Is there any good pseudocode I can use that will fit in around QS?

Thanks
Colin
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Null move pruning

Post by hgm »

I think most people nowadays don't bother with verification anymore. Just start with recursive NMP (i.e. an unlimited number of null moves in a branch). You could forbid two null in direct succession ("double null move"), but even that is not needed, and some even claim that double null move is better. In fact micro-Max does an unlimited number of null moves in direct succession, and even then NMP enhances its search enormously.

Reduce by 3 ply, or by 3 ply deep in the tree, and by 2 close to the leaves.
User avatar
pedrox
Posts: 1056
Joined: Fri Mar 10, 2006 6:07 am
Location: Basque Country (Spain)

Re: Null move pruning

Post by pedrox »

Page Bruce Moreland:

http://www.seanet.com/~brucemo/topics/nullmove.htm

WikiChess:

http://chessprogramming.wikispaces.com/ ... ve+Pruning

Code: Select all


	//we proved a null move
	if (do_null && !incheck) {
		if (piece_mat[side] >= piece_value[KNIGHT]) {

			depthnull = depth - 1 - R - (depth>5);

			old_ep = ep; // now make mullmove
			ep = -1;
			side ^= 1;
			xside ^= 1;
			old_hash = hash;
			set_hash();

			x = -search(-beta, -beta + 1, depthnull, FALSE);
			
			hash = old_hash;  // now undo mullmove
			xside ^= 1;
			side ^= 1;
			
			if (depth >= 7 && x >= beta) { //now verification in endgame (not want zugzwangs)
				if &#40;piece_mat&#91;side&#93; <= 1260&#41; &#123;
					depthnull = depth - 6;
					x = search_no_full&#40;alpha, beta, depthnull&#41;;
				&#125;
			&#125;			
			
			ep = old_ep;

			if &#40;x >= beta&#41; 
				return beta;  //prunning
		&#125;
	&#125;

User avatar
cms271828
Posts: 316
Joined: Wed Apr 12, 2006 10:47 pm

Re: Null move pruning

Post by cms271828 »

Thanks, I was already looking at Bruce Morlands site..

I don't get it though, where it says..

Code: Select all

MakeNullMove&#40;);
val = -AlphaBeta&#40;depth - 1 - R, -beta, -beta + 1&#41;;
UnmakeNullMove&#40;);
if &#40;val >= beta&#41; return beta;
Then supposing we're at a white node, what is the null move?
It doesn't say anything about generating moves like it does in the regular code with GenerateLegalMoves().

I thought the idea was to let black(in this instance) have 2 moves, so that if his score is still bad, whites move must have been strong.

:oops:
Colin
Harald Johnsen

Re: Null move pruning

Post by Harald Johnsen »

The null move is still a move from the point of view of the search code. You do everything you do for a normal move except that you don't move anything on the board.
Black made his move, white is doing his null move and you call search() so black will play again.

HJ.