public static void Main()
var calc = new PointsCalculator();
for(int ms=0; ms<=8000; ms += 500)
double test = calc.GetPointsFor(ms);
Console.WriteLine(ms + " = " + test);
public class PointsCalculator
private int SIGMOID_RANGE;
public PointsCalculator(int minRating=1, int maxRating=2000, int minPoints=1, int maxPoints=8000, int sigmoidRange = 20)
SIGMOID_RANGE = sigmoidRange;
public double GetPointsFor(double value)
return MapToRating(value);
public double Sigmoid(double x)
return 1 / (1 + Math.Exp(-x));
private double MapToRange(double value, int low, int high, int new_low, int new_high)
return value * 1.0 / (high - low + 1) * (new_high - new_low + 1);
private double MapToSigmoid(double value, int max = 0)
if(max == 0) max = SIGMOID_RANGE;
return MapToRange(value, MIN_RATING, MAX_RATING, 1, max) - (max / 2.0);
private double MapToRating(double value, int max = 0)
if(max == 0) max = SIGMOID_RANGE;
double rating_range = MapToRange(value, MIN_POINTS, MAX_POINTS, MIN_RATING, MAX_RATING);
double sigmoid_range = MapToSigmoid(rating_range, max);
double s = Sigmoid(sigmoid_range);
r = Math.Floor(s * MAX_RATING);
r = Math.Ceiling(s * MAX_RATING);