The issue is that AB search is set at e.g. 6 plies, but the cut-off cuts away the complete branch with the winning sacrifice as the combination leading to the win is refuted. In pure minimax, the mate is found.Ras wrote: ↑Fri Apr 30, 2021 2:53 pmWhich is also why Minimax wouldn't find a mate at 2 plies.ydebilloez wrote: ↑Fri Apr 30, 2021 2:38 pmAt ply 2 in this situation, the best score white can think off is queen down... there is no mate in any of the moves
So beta-cutoff here is futility pruning?
In the last commit, I cleaned up the AB search a bit so that housekeeping code gets out of the way and the algorithm stands out more clear.
From search_ab.cpp (but simplified for the question here)
Code: Select all
for (movenum_t moveid = 0; moveid < n_moves; moveid++) {
bBoard chldbrd(b, moveid, true);
bScore chldscore = -CalcBestMove(chldbrd, nDepth + 1, -beta, -alpha);
b.setMoveScore(moveid, chldscore);
if (belofte::realScore(chldscore) - nBetaCutOffMargin >= belofte::realScore(beta)) {
return chldscore; // (fail soft)
}
if (belofte::realScore(chldscore) > belofte::realScore(alpha)) {
// 𝛼 & ↑ update
b.setBestScore(chldscore);
alpha = chldscore;
}
}
Please also note I use score for two purposes, set flags on theoretic draw/undefined/etc... and normal score. This is why the call to realscore is required.
In my chess engine, one can disable beta-cutoff in AB search and in AB QS search by setting nBetaCutoffMargin to a high value. One can set the algorithm to AB or ABFS with the alg command.