a) Moves does not have to be generated again, so I will just set the move generation status to GEN_RESET. So this saves move generation calls at internal nodes and also have the nodes counts as scores. The benefit from saving move generation might not be that important but move sorting as in (b) may help specially with LMR. Right now if the IID failed high, I do not do it since I will only have a partial move list. Instead I pick the two moves with the highest nodes count and put them in killers list.
b) The second benefit (hopefully important) is now I can sort the moves based on nodes count like it is done for root sorting. In the past there were attempts to use that kind of sorting using smaller hash tables on PV nodes other than the root. I guess this is a good alternative to that idea specially if you do IID in many internal nodes. The IID will bring up a good first move in any case, but sorting the other moves maybe of some help anyway.
I do internal iterative deepening not only on PV nodes but on CUT nodes as well so the chances of doing IID are higher. I haven't measured how much I get from this but it is working fine in Nebiyu now. Before I did this full move sorting at internal nodes, I tried to take advantage of the idea via killers. That worked but I did not bother to measure the elo improvement I got from it if any.
Daniel
Psuedo code after IID is finished:
Code: Select all
case IID_SEARCH:
sb->pstack->hash_move = sb->pstack->best_move;
sb->pstack->hash_score = sb->pstack->best_score;
if(sb->pstack->flag == EXACT || sb->pstack->flag == LOWER)
sb->pstack->hash_flags = HASH_GOOD;
sb->pstack->hash_depth = sb->pstack->depth;
sb->pstack->search_state = SINGULAR_SEARCH;
/*reset move generation*/
if(sb->pstack->flag == LOWER) {
sb->pstack->gen_status = GEN_START;
/*put two moves with highest nodes count in killers*/
sb->pstack->sort(0,sb->pstack->count);
move = sb->pstack->move_st[0];
if(move == sb->pstack->best_move) {
sb->pstack->sort(1,sb->pstack->count);
sb->pstack->killer[0] = sb->pstack->move_st[1];
sb->pstack->sort(2,sb->pstack->count);
sb->pstack->killer[1] = sb->pstack->move_st[2];
} else {
sb->pstack->killer[0] = move;
sb->pstack->sort(1,sb->pstack->count);
sb->pstack->killer[1] = sb->pstack->move_st[1];
}
} else {
sb->pstack->gen_status = GEN_RESET_SORT;
/*put best move first*/
for(int i = 0;i < sb->pstack->count;i++) {
if(sb->pstack->hash_move == sb->pstack->move_st[i])
sb->pstack->score_st[i] = MAX_NUMBER;
}
}
break;