Author Topic: Formula help !!!  (Read 1460 times)

BigColino

  • Newbie
  • *
  • Posts: 2
    • View Profile
Formula help !!!
« on: October 14, 2007, 10:51:04 PM »
I don't know how to use the formula so I need help !!

I give my points like this !!
Half the field makes points so if there is 20 players 10 make points.....1pt for 10th, 2pts for 9th....10pts for first...

Plus there is bonus points for top 3....5 bonus points for 1st, 3bp for 2nd and 1bp for 3rd.

So if I have 46 players, 23 makes points, 23pts for 1st + 5BP so 28pts for 1st....22pts for 2nd + 3BP so 25pts....and so on....1 pt for 23rd

When I have an uneven number of players, I go 1 down, so 23 players is the same as 22 players...

Thanks in advance for the response !!!



tandemrx

  • Sr. Member
  • ****
  • Posts: 327
    • View Profile
Re: Formula help !!!
« Reply #1 on: October 15, 2007, 10:03:34 AM »
Do you ever have less than 10?

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5381
    • View Profile
Re: Formula help !!!
« Reply #2 on: October 15, 2007, 10:13:34 AM »
if(r < 11, max(0, floor(n/2) - r + 1)) + switch(r, 1, 5, 2, 3, 3, 1)


tandemrx

  • Sr. Member
  • ****
  • Posts: 327
    • View Profile
Re: Formula help !!!
« Reply #3 on: October 15, 2007, 03:12:40 PM »
Corey,

Glad you figured it out before I tried, mine would have been much more complex somehow (didn't think about the "floor" function and that it would work to effectively round off the result for odd number of players).

I am interested to note that you don't have a 3rd parameter for the "if" function and the equation still works.  Does the "if" function automatically (by default) return "0" if condition isn't met?

it also seems to work the same if you use if(r < 11, max(0, floor(n/2) - r +1, 0) for the first part of the equation.

Or am I missing something.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5381
    • View Profile
Re: Formula help !!!
« Reply #4 on: October 15, 2007, 04:36:41 PM »
Yes, omitting the "else" clause of the if() function defaults the value to 0.  Same with the switch() function.

BigColino

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Formula help !!!
« Reply #5 on: October 15, 2007, 06:07:59 PM »
Thank you very much !!
I tried the formula with 45 players and it stopped giving points after the 10th position
so I changed the formula a bit and it works !!!

if(r < 11, max(0, floor(n/2) - r + 1)) + switch(r, 1, 5, 2, 3, 3, 1)
to
if(r < n, max(0, floor(n/2) - r + 1)) + switch(r, 1, 5, 2, 3, 3, 1)

BigColino



Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5381
    • View Profile
Re: Formula help !!!
« Reply #6 on: October 15, 2007, 06:27:32 PM »
Yeah, somehow I got it into my head that you wanted only the top 10 players to receive points (instead of half of the entrants), probably because of your first example.  The formula should be:

max(0, floor(n/2) - r + 1) + switch(r, 1, 5, 2, 3, 3, 1)

Just remove the outer "if()" statement.  Your version will work, too, it's just doing a little bit more work.