Am trying to combine PVS with null-move. Sofar this gives 150 elo LESS than without this combination. I probably made a bug:
Code: Select all
int bestVal = -infinite;
bool first = true;
for(idx=0; idx<nMoves; idx++) {
Move m = moveList.at(idx);
newSearchDepth = currentDepth - 1;
if (kingUnderAttack() == false && currentDepth >= 3 && m.attack != false && m.promote == false) {
if (idx > 5)
newSearchDepth = currentDepth - 3;
else if (idx > 3)
newSearchDepth = currentDepth - 2;
}
doMove(m);
int score;
bool use = false;
if (moveRepeats()) {
if (0 > bestVal) {
bestVal = 0;
use = true;
}
first = false;
}
else if (first) {
score = -search(newSearchDepth, -beta, -alpha);
if (score > bestVal) {
bestVal = score;
use = true;
}
first = false;
}
else {
score = -search(newSearchDepth, -alpha - 1, -alpha);
if (score > alpha && score < beta)
score = -search(currentDepth - 1, -beta, -score);
if (score > bestVal) {
bestVal = score;
use = true;
}
}
undoMove();
if (bestVal > alpha)
alpha = bestVal;
if (bestVal >= beta) {
betaCutOff = true;
break;
}
}