The Tournament Director Forums

Main => Help Me => Topic started by: jodybingo on July 26, 2010, 02:33:17 AM

Title: Put this into a formula...
Post by: jodybingo on July 26, 2010, 02:33:17 AM
Hi Corey and anyone else that can tackle this...
Here is an excerpt of an email I recieved about the points system used by a league here in Canada (LTPQ). I haven't any clue how to write a formula for this...

Quote...
First we determine the leading pack (lp) which is = 30% (rounded down) of
the number of participants in the tournament (P), then we substract the
leading pack (lp) from the number of participants (P) to get the remaining
field (F).

30%P = lp
P-lp = F

Arbitrarily, the first player eliminated from the leading pack receives 250
points. The second one, 400 points and each player after that, 100
additional points.

It's quite hard to put in a formula.

Then the field is divided by 10 to find out how many players will be in each
bracket of ten points. The remaining decimal is added to the number of
players getting 10 points.

So, if F = 45, F/10 = 4.5 then, 4 players will get 100 points, 4 other
players 90 points, etc, and 9 players will receive 10 points.

End Quote.
Thanks to all that can help
Title: Re: Put this into a formula...
Post by: Corey Cooper on July 26, 2010, 10:39:06 AM
assign("lp", round(n * .3));
assign("F", n - lp);
if(r <= lp, 250 + max(0, lp - r) * 100, max(10, 110 - (ceil((r - lp) / floor(F / 10)) * 10)))
Title: Re: Put this into a formula...
Post by: jodybingo on September 02, 2010, 03:42:00 AM
Thanks for the help with this formula Corey. I need some more help with it though. The points on one position aren't coming out properly. I changed the 250 in the formula to 300 ( formula was producing points ending in 50). The error in points is coming from the lowest position in the leading pack (lp). The formula is awarding 300 points. This needs to be set to 250. The first bust out from the leading pack is the only position to produce points ending in 50 (in the leading pack). A table was created showing the points and can be viewed at
http://www.ltpq.com/tablerank.php?lang=en (http://www.ltpq.com/tablerank.php?lang=en)
Thanks.
Jody
Title: Re: Put this into a formula...
Post by: Corey Cooper on September 02, 2010, 12:21:12 PM
Looks like I missed this part:

Quote
Arbitrarily, the first player eliminated from the leading pack receives 250
points. The second one, 400 points and each player after that, 100
additional points.


Here's the updated formula.  The parts I added or changed are in bold italic.

assign("lp", round(n * .3));
assign("F", n - lp);
if(r <= lp, 300 + max(0, lp - r) * 100 - if(r = lp, 50), max(10, 110 - (ceil((r - lp) / floor(F / 10)) * 10)))

Title: Re: Put this into a formula...
Post by: Corey Cooper on September 02, 2010, 12:23:37 PM
One more thing.  The formula seems to work, but I realized this, too:

Quote
First we determine the leading pack (lp) which is = 30% (rounded down)

And the formula I gave has this corresponding part:

assign("lp", round(n * .3))

But the round() function rounds to the nearest whole number, either up or down.  Technically, this should use the floor() function to round down.  But I didn't go back and try to completely understand every part of this again, so maybe there's a reason I used round() instead of floor().  Regardless, it seems to work the way it is now.