i have not used "+=" before

At constraint page add the following lines:

d+= Math.sqrt((x-xs)*(x-xs)+(y-ys)*(y-ys)); [b][color=blue]// what is += ?? is it a syntax for line integral of absolute value of displacement.[/color][/b]

xs=x;

ys=y;

that is so cool!