working implementation of alpha-beta pruning