returns linear friction coeff. When `value` is 0 coeff is 1 (no friction), then it grows linearly until it reaches `MAX_FRICTION` when `value` is equal to `MAX_VALUE`
function friction(value) {
  const MAX_FRICTION = 5;
  const MAX_VALUE = 100;
  return max(
    1,
    min(MAX_FRICTION, add(1, multiply(value, (MAX_FRICTION - 1) / MAX_VALUE)))
  );
}