'working' alphabeta algorithm