Author Topic: help formula  (Read 1681 times)

pirri

  • Newbie
  • *
  • Posts: 4
    • View Profile
help formula
« on: January 06, 2012, 06:31:20 AM »
Hello I want to program a formula but I have some problems with English and I can not understand how if someone can help me thank

how can I do the following: 40 points for 1st to decrease,( if 30 players for the first 40 points and 10points to 30º ), 3 points buy-in, 1 point bounty our hit?

help me please

The Meal

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: help formula
« Reply #1 on: January 06, 2012, 09:34:50 AM »
I'll take a stab at it!

I see three separate cases for adding points:
(a) A range from 40 points to 10 points linearly spaced from 1st place to last place (e.g., if 30 players, first gets 40 points, last gets 10 points),
(b) 3 points just for buying in, and
(c) 1 point for knocking out a player.

The formula below won't work if any of my assumptions above are incorrect.  (Obviously.)

Code: [Select]
10 + 30 * (n - r) / (n - 1) + 3 + numberOfHits
Part (a) is the 10 + 30 * (n-r)/(n-1),
Part (b) is the +3, and
Part (c) is the +numberOfHits.

Hope this helps!

Magic_fubu

  • Hero Member
  • *****
  • Posts: 1035
    • View Profile
Re: help formula
« Reply #2 on: January 06, 2012, 12:48:49 PM »
I'll take a stab at it!

I see three separate cases for adding points:
(a) A range from 40 points to 10 points linearly spaced from 1st place to last place (e.g., if 30 players, first gets 40 points, last gets 10 points),
(b) 3 points just for buying in, and
(c) 1 point for knocking out a player.

The formula below won't work if any of my assumptions above are incorrect.  (Obviously.)

Code: [Select]
10 + 30 * (n - r) / (n - 1) + 3 + numberOfHits
Part (a) is the 10 + 30 * (n-r)/(n-1),
Part (b) is the +3, and
Part (c) is the +numberOfHits.

Hope this helps!

In case it doesn't like numberOfHits, you could replace it with nh and that should work as well.
My cowboys shot down your rockets
---
If you send a request to me please send that you got me from here w/your TD name to confirm. Thanks!

pirri

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: help formula
« Reply #3 on: January 06, 2012, 12:57:40 PM »
one more thing if there is 40 players 1º receive 40 points and  the last receave 1
40,39,38.......1

but if 30 players,   1º 40 points 2º 39, 38 and the last 10 points

its the same formula like that?

tks

The Meal

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: help formula
« Reply #4 on: January 07, 2012, 02:01:20 PM »
one more thing if there is 40 players 1º receive 40 points and  the last receave 1
40,39,38.......1

but if 30 players,   1º 40 points 2º 39, 38 and the last 10 points

its the same formula like that?

tks

No, my formula does not do that.

This formula (I believe — someone else can confirm) would do that:

Code: [Select]
if(r < 41, 41 - r, 0) + 3 + numberOfHits

pirri

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: help formula
« Reply #5 on: January 08, 2012, 02:58:21 PM »
I will test hit tks

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: help formula
« Reply #6 on: January 09, 2012, 10:58:12 AM »
The alternative would be to use max to ensure no one gets negative points.  So instead of:

if(r < 41, 41 - r, 0)

You could use:

max(41 - r, 0)

But they are equivalent, so either will work fine.

pirri

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: help formula
« Reply #7 on: January 09, 2012, 04:59:22 PM »
I will test tks