Code: Select all
int NegaScout(int alpha, int beta, int depth)
{
. . .
. . .
TransItem *tt_item;
if (tt->getItem(board->hash(), tt_item)) {
if (tt_item->getScore(alpha, beta, depth, score))
return score;
. . .
. . .
}
. . .
. . .
}
bool getScore(int alpha, int beta, int inDepth, int &inScore)
{
if ((type & HAS_SCORE) && depth >= inDepth) {
switch (type) {
case PV_NODE:
inScore = ????;
break;
case CUT_NODE:
inScore = ????;
break;
case ALL_NODE:
inScore = ????;
break;
}
return true;
} else {
return false;
}
}
What score should I be returning? I've thought of a few possibilities.
ALL_NODE: score
CUT_NODE: score
PV_NODE: score
ALL_NODE: alpha
CUT_NODE: beta
PV_NODE: score
ALL_NODE: min(score, alpha)
CUT_NODE: max(beta, score)
PV_NODE: max(alpha, min(score, beta))