compute method

int compute(
  1. BishopState state
)

Computes the hash of state.

Implementation

int compute(BishopState state) {
  List<int> board = state.board;
  int hash = 0;
  for (int i = 0; i < board.length; i++) {
    if (board[i].isNotEmpty) hash ^= table[i][board[i].piece];
  }
  if (state.epSquare != null) hash ^= table[state.epSquare!][meta];
  hash ^= table[castling][state.castlingRights];
  if (state.turn == Bishop.black) hash ^= table[turn][meta];
  // todo: hands and gates

  return hash;
}