function linear_approach(val, goal, amount) {
if abs(val-goal) < amount val = goal;
if val < goal return val+amount;
if val > goal return val-amount;
if val == goal return goal;
}