finish prediction algorithm