'Calculate score of board state and return player ID (1, -1, or 0 for tie)
corresponding to winner. Uses \'Area scoring\'.'

def get_winner(self):

    score_white = np.sum((self.board == WHITE))
    score_black = np.sum((self.board == BLACK))
    empties = zip(*np.where((self.board == EMPTY)))
    for empty in empties:
        if self.is_eyeish(empty, BLACK):
            score_black += 1
        elif self.is_eyeish(empty, WHITE):
            score_white += 1
    score_white += self.komi
    score_white -= self.passes_white
    score_black -= self.passes_black
    if (score_black > score_white):
        winner = BLACK
    elif (score_white > score_black):
        winner = WHITE
    else:
        winner = 0
    return winner
