Echecs.Zobrist (Echecs v0.1.5)

Copy Markdown View Source

Zobrist hashing for fast position identity and repetition detection.

All random keys (piece/square, castling states, en-passant files, side to move) are generated once at compile time into tuple tables. hash/4 hashes a full position; update_hash_int/10 incrementally updates a hash from unpacked move fields without touching the board.

Summary

Functions

hash(board, turn, castling, en_passant)

init()

update_hash(current_hash, move, piece, target_piece, arg1, arg2, turn)

update_hash_int(current_hash, from, to, promotion, special, piece, target_piece, arg1, arg2, turn)

Incremental Zobrist hash update using unpacked move fields (no struct needed).