alphabeta function is completed.