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

Evaluation/Search observation #7

Open lewismj opened 1 year ago

lewismj commented 1 year ago

Thanks so much for the YouTube tutorial. It was a pleasure following it.

One thing I noticed, with the custom eval, given this position:

r4rk1/p1p2ppp/1p1nb3/2p1n3/2P2P1N/BP2P3/P1B3PP/R3K2R b - - 0 1

The engine seems to pick (at any depth) e5c4

If I set the passed pawn bonuses to 0, then it gives more sensible, e5c6;. At the moment, not sure if its the eval, size of the bonuses, or the search.

tissatussa commented 1 year ago

..set the passed pawn bonuses to 0 ..

how to do that ? there is no UCI option for it, and in the few source files i find no code line which sets such value ..

lewismj commented 1 year ago

custom evaluation, that would be the early version 1.2 (or any version that uses the eval. function from that version) there is a line of code:

https://github.com/maksimKorzh/bbc/blob/master/src/old_versions/bbc_1.2.c

const int passed_pawn_bonus[8] = { 0, 10, 30, 50, 75, 100, 150, 200 };

in the example I cited, where it seems to choose a strange move, its due to those values, set them to zero, or tweak them lower and it picks a better move, maybe its the size of the bonus, or something throwing off the search.

lewismj commented 1 year ago

image image

First is the custom eval, 1.2 vs 1.3 (note, I also replicated by putting back the original evaluation in 1.4 to reproduce it), set the pawn bonuses lower and it picks the same as the NNUE version.

lewismj commented 1 year ago

The one thing you notice, if you do play around with the passed_pawn_bonus array is that it can impact the nodes removed by the late move reduction... (just on the early versions that used the custom evaluation) interesting to see the trade offs. But you can see why NN evals are preferred these days, tweaking custom eval is clearly tricky.