zorbristHash_3.py 299 B

1234567891011121314
  1. def hash(self, board, colour):
  2. h = 0
  3. if colour == 'black':
  4. h = h ^ self.black_move
  5. p = 0
  6. for i in range(128):
  7. if (i & 0x88) == 0:
  8. if board.board[i] != None:
  9. j = self.constVal[self.pieceChar.index(board.board[i].character)]
  10. h = h ^ self.table[p][j]
  11. p += 1
  12. return h