update score algorithm