3

I'm developing a game. Assume I have 5 kids. Every kid has different amount of chocolates. Assume each of them has:

  • KID 1 has 5 chocolates
  • KID 2 has 10 chocolates
  • KID 3 has 5 chocolates
  • KID 4 has 2 chocolates
  • KID 5 has 1 chocolates

What I want is to find the percentage of balance of chocolates. Like if they all have equal amount of chocolates the percentage will be 100%. Yeah, this percentage is a score of the game.

Do you have any logic to find this out? Please help.. Thanks!

Sena
  • 33

1 Answers1

2

There is no standard way to define "percentage of balance", but a reasonable method is:

  1. Calculate $\mu$, the average number of chocolates per kid, i.e. the quota. For the example given, $\mu=(5+10+5+2+1)/5=4.6$.

  2. Calculate $s$, the summed square difference of each value from $\mu$. For the example given, $s=(5-4.6)^2+(10-4.6)^2+(5-4.6)^2+(2-4.6)^2+(1-4.6)^2=49.2$.

  3. Calculate $t$, the maximum possible value for $s$. This would be if all the chocolates were with one kid. Here $t=(23-4.6)^2+4(0-4.6)^2=423.2$.

  4. Finally, rescale from $[0,t]$ to $[100,0]$ via $$f(s)=100\left(1-\frac{s}{t}\right)$$ For the example given, $f(s)\approx 88.4$ percent of balance.

vadim123
  • 82,796
  • sorry but, is 4 in t=(23−4.6)2+4(0−4.6)2=423.2. from (kids total - 1)? – Sena Aug 26 '18 at 08:36
  • 1
    Yes; it is my lazy way of writing $(23-4.6)^2+(0-4.6)^2+(0-4.6)^2+(0-4.6)^2+(0-4.6)^2$. – vadim123 Aug 26 '18 at 14:00
  • Hello, It's been 4 years and I come back to this question because coincidentally I need the formula for my research paper. Can you provide any source for the answer you gave? Thank you @vadim123 – Sena Jul 06 '23 at 06:56