KYLChiu / sporkfish

Chess engine in Python
MIT License
5 stars 0 forks source link

[SPORK-70] Incremental Zobrist hash #109

Closed KYLChiu closed 7 months ago

KYLChiu commented 7 months ago

Implements incremental Zobrist hash as opposed to computing the hash via full information.

This leads the performance to be fairly equal to base case:

FEN: 8/8/8/8/5R2/2pk4/5K2/8 b - - 0 1 Base, 20302099 function calls (20229039 primitive calls) in 6.205 seconds Transposition table, 11647835 function calls (11604146 primitive calls) in 4.043 seconds

FEN: r1b2rk1/ppqn1pbp/6p1/3pp3/7B/2PB1N2/PP3PPP/R2QR1K1 w - - 0 16 Base, 48916378 function calls (48808919 primitive calls) in 16.903 seconds TT, 50581630 function calls (50466170 primitive calls) in 17.850 seconds (I am not sure why more function calls here either)

I am not quite happy with it yet, but would like this to go in as this is a vast improvement over full hash computation. Will explore avenues of improvement of TT and optimizing the hash calculation in next PR.

KYLChiu commented 7 months ago

Superseded by #110