I think you need to specify your problem better.

What's the significance of the transformation of the graph? What's a grade? What's the turns that are taken when a cumultative grade is resetting...