Unfortunately it works the same as the current version.Joost Buijs wrote: ↑Thu Aug 06, 2020 5:45 pm I would say something like:
Probably better to introduce a ply counter as well, since you only have to update the best_move at ply 0, I assume best_move is the move that you want to play eventually.Code: Select all
if (score > alpha) { best_sofar = xxx; if (score >= beta) return score; // or return beta for fail hard alpha = score; }
Code: Select all
if (score > alpha) { best_sofar = xxx; if (ply == 0) best_move = best_sofar; if (score >= beta) return score; // or return beta for fail hard alpha = score; }
In mate in 1 position both versions solve mate in 1 in the depth range 2-5 but starting from depth 6 it doesn't mate.
ANYWAY I want to thank everyone for taking time on explanations.
I guess my main problem is a LACK OF UNDERSTANDING THE ALGORITHM rather than not knowing how to apply it, so I will go studying negamax search first, then alpha beta pruning and only then I'd get back to this issue.
Again thank you all and sorry for torturing community members without having even a basic understanding of algorithm itself.
Now I know the direction - just work this algorithm out until I get it in great details and then try to apply it to chess.

