Moderator: Andres Valverde
Zach Wegner wrote:..., the program is just going like this:
probe hash
no move found, reduce depth and start over
probe hash
no move found, reduce depth and start over
...
while(a>b) a--;
probe hash
if(no move found) reduced depth = 0;
else reduced depth = hash depth
while(reduced depth < desired depth)
increase depth and start over
Zach Wegner wrote:No, you still probe hash for the child positions, just not the position you are doing IID for.
But about the 3-fold repetition detection: don't you do that from the same hash table entry? Even before looking at what the move is the hash table recommends for this position, you can look at the number of previous visits. If that was two, you declare a draw straight away, and you never get to wondering what the move or the depth is, or how you should commence IID. If the position was not in the hash table, apparently it was no repetition.
Daniel Shawul wrote:The point is that you are going to look at previous positions twice.
Obviously the position is not a repetition (since we would have stopped search if it was), but you are doing the work twice just to prove it is not a reptition when once is enough. The hashtable will not be any help since we only try IID where we don't have a hashtable move.
H.G.Muller wrote:Perhaps the thing I do not properly understand is how you are going to find out if it is a repetition if it is not in the hash table. If it is not, I don't have to worry about doing that twice, because I don't even know how to do it once.
Apparently, you have a way to find out if something is a repetition without the aid of the hash table. I have no such way, for me every position that occured before (in the game or in the tree) is kept in the hash table, so if it is not in the hash table, it was no repetition.
Daniel Shawul wrote:Zach,
i guess that this is obvious for you probably because probably because your search is non recursive?
i also don't probe the hashtable twice, but i still generate the moves again.
I tried to do this but left it later because my move generation is incremental and is complicated. Implementing IID in a non-recursive search is a bit hard (even harder than null move).
The stack element at the point of where we try IID may be corrupted.
For example, the alpha-beta bounds should be saved befroe doing IID and restored later.
/*internal iterative deepening*/
if (!board->hashmove[sb->ply] && sb->alpha + 1 != sb->beta && !board->threatm[sb->ply] && sb->depth > 3 * PLY && sb->donull)
{
SEARCH(sb->depth - 3 * PLY, sb->ply, sb->alpha, sb->beta, 1, NODEPV, IID1);
iid1: val = (sb + 1)->rv;
if (val > sb->alpha && val < sb->beta)
board->hashmove[sb->ply] = MOVE(board->pv[sb->ply][sb->ply]);
}
else
{
genattacks(board);
if (board->incheck[sb->ply])
board->firstmove[sb->ply + 1] = genevasions(board, board->firstmove[sb->ply], board->incheck[sb->ply]);
else
board->firstmove[sb->ply + 1] = gen(board, board->firstmove[sb->ply]);
}
H.G.Muller wrote:I can't think of any reason why you would not always do it like this:
Alessandro Scotti wrote:The "other" typical method is a simple loop comparing the hash code of the current position with that of positions that occurred earlier in the game or in the search path.
Looks amazingly inefficient, but works fairly well in practice.
Zach Wegner wrote:That is what I do. It has the advantage of being error free i.e. not dependent on the hash table, which overwrites. Also you only have to check positions of the same side to move, and only as far back as the last irreversible move (capture/pawn move).
Return to Programming and Technical Discussions
Users browsing this forum: No registered users and 18 guests