maksimKorzh / bbc

Bit Board Chess (BBC) - The easiest to understand bitboard chess engine by Code Monkey King
GNU General Public License v3.0
60 stars 18 forks source link

Aspiration window with "wrong" depth ? #5

Open mkd opened 2 years ago

mkd commented 2 years ago

Hi Maksim,

First of all, a HUGE THANKS for your code and video tutorials on YouTube. You inspired me to retake my old chess engine Chess0 and include the NNUE evaluation. It has been a success thanks to you and Daniel Shawul.

I'm now trying to optimize the search code, and I'm learning from your code a lot! However, there's one thing I still don't get:

In your search_position, you set a kind of aspiration window (alpha = alpha - 50; beta = beta + 50). If you fall outside and try to do a full search, you tell in your comment that it should be a full-width window at the same depth. However, after doing "continue" in the code below, current_depth gets incremented when starting the loop over (current_depth++).

See code below:

    // we fell outside the window, so try again with a full-width window (and the same depth)
    if ((score <= alpha) || (score >= beta)) {
        alpha = -infinity;    
        beta = infinity;      
        // current_depth--    should you add this to search at the same depth??
        continue;
    }

Thanks again for the excellent video tutorials and taking all the time. I'm sure it has inspire many more people!

Cheers, --Claudio