refactor while loops in turn_of_greed