Regarding null moves. I noticed that my chess program fails horribly when null moves are enabled. E.g. doing moves like a2-a3 or h2-h4.
I would like to describe what I'm doing, maybe someone spots the problem?
My chess program has a search(depth, color, alpha, beta) function. Furthermore it has an evaluate(color) function which returns the score of a position seen from the `color' point of view.
While doing a search, it calls itself with
Code: Select all
score = -search(depth - 1, opponentColor, -beta, -alpha)
if (score > bestVal) { bestVal = score; }
if (score > alpha) { alpha = score; if (score > beta) beta_cutoff = true; }So far so good.
Now for the null-move.
First I check if depth > 3 (e.g. there are more than 3 moves left before we enter quiescence search, I also check for being-in-check-status), then I invoke search:
Code: Select all
score = search(depth - 3, color, beta - 1, beta);I don't negate the values because (and I'm not sure about this) the search is invoked with the current color (e.g. not the opponent).
Then, I do:
Code: Select all
if (score > beta) { beta_cutoff = true; bestVal = score; }I also don't update the transpositiontable because it is an incomplete search.
Any ideas?
regards
