bumpSumBounded function
Keeps summing the incoming score, keeping it within a
min, max
range.
Implementation
BumpFn bumpSumBounded(int min, int max) {
return (value, delta) {
final v = value.value + delta;
if (v >= max) {
return max;
} else if (v <= min) {
return min;
}
return v;
};
}