Closed koba-e964 closed 2 years ago
Thank you for pointing it out!
I intended to calculate the key by taking xor
with Table[(number of pieces) - 1]
starting from 0
with no hand pieces. (Position::new
calculated that way).
But, in do_move
, it was calculated using the number of pieces after capture, so it will be out of bounds...
I fixed at #21.
I intended to calculate the key by taking
xor
withTable[(number of pieces) - 1]
starting from 0 with no hand pieces. (Position::new calculated that way).
My apologies, I completely missed that. Thank you for pointing it out, this cumulative-sum method is clearly better at computing the difference made by moves.
MAX_HAND_NUM is 18. For a position where someone has all 18 pawns in hand, this line probably causes out-of-bounds accesses. https://github.com/sugyan/yasai/blob/a7011ec7c1216bb2cf07d929c2c9722f062154f0/src/zobrist.rs#L52