finished alpha beta pruning function