I'm researching this code by Bruce Moreland:
Code: Select all
int AlphaBeta(int depth, int alpha, int beta)
{
int hashf = hashfALPHA;
if ((val = ProbeHash(depth, alpha, beta)) != valUNKNOWN)
return val;
if (depth == 0) {
val = Evaluate();
RecordHash(depth, val, hashfEXACT);
return val;
}
GenerateLegalMoves();
while (MovesLeft()) {
MakeNextMove();
val = -AlphaBeta(depth - 1, -beta, -alpha);
UnmakeMove();
if (val >= beta) {
RecordHash(depth, beta, hashfBETA);
return beta;
}
if (val > alpha) {
hashf = hashfEXACT;
alpha = val;
}
}
RecordHash(depth, alpha, hashf);
return alpha;
}
Code: Select all
if (depth == 0) {
val = Evaluate();
RecordHash(depth, val, hashfEXACT);
return val;
}
I tried this schema and if NOT storing hash entry the performance grows dramatically and PV line remains the same while if I store hash entry with exact value returned from quiescence search I'm getting my search at least twice slower and it's giving a completely different PV, not that bad but worth compared to "normal" PV.
Can someone please explain me WHY Bruce stores hash entry when static eval returned (no matter directly or from quiescence)?