Author Topic: Formula Help  (Read 1874 times)

Mahound

  • Sr. Member
  • ****
  • Posts: 395
  • THE ONLY time i get screwed is when i play poker!
    • View Profile
Formula Help
« on: April 26, 2012, 09:54:34 AM »
Could you take a look a this points system below. It is for a team game 80 players - 4 in a team. I want to try and make a formula based on this.
I know that i can award points on the game tab for
Playing in the game and
Earning a bounty etc.

But there are a couple of things that i would like to know. would like to know a formula for the point system below. and the hardest part. Is there any way to award a player 1 point for every full level that they last in a tournament.
example a player gets knocked out in level 5 and they would receive 4 points, a player gets knocked out in level 10 and would receive 9 points and so on.
Not forgetting that the player who wins the game in level 18 would they would win 17 points
and finally would there be anyway of collating the points of the teams together.

Any help would be greatly appreciated. Any thoughts negative or otherwise would be welcome too.

Points
A points scoring system will be used to determine the winning team (an additional point will awarded for each bounty won) the team with the highest points total will win the team prizes.

How Teams earn points  :-
•   Each player gets 1 point for playing in the game
•   For every bounty a player wins their team will win 1 point
•   Each player earns  1 point for every full level that they survive.

For example all player earns points :-
80 players in the game - 20 teams of 4 players

•   Players  eliminated in positions 80th  - 77th will each receive 1 point
•   Players eliminated in positions  76th  - 73rd will each receive 2 points
•   Players  eliminated in positions 72nd  - 68th will each receive 3 points

and so on with each group of 4 players winning 1 more point than the players who are eliminated before them

•   Players  eliminated in positions 12th  - 9th eliminated will each receive 18 points
•   Players  eliminated in positions 8th - 5th will each receive 19 points
•   Players  eliminated in positions 4th  - 1st will each receive 20 points

« Last Edit: April 26, 2012, 10:23:21 AM by Mahound »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Formula Help
« Reply #1 on: April 27, 2012, 12:49:45 PM »
Alright, I'll take a stab at this.

Quote
Each player gets 1 point for playing in the game

1

Quote
For every bounty a player wins their team will win 1 point

nb

Quote
Each player earns  1 point for every full level that they survive.

roundOut - 1

In version 3, the "RoundOut" variable is available, making this easy.  My notes say that this was actually in version 2 but not documented, so this could potentially work with 2.5.13 (haven't tested it, and didn't go back to look in which version it was added).

Quote
For example all player earns points :-
80 players in the game - 20 teams of 4 players

•   Players  eliminated in positions 80th  - 77th will each receive 1 point
•   Players eliminated in positions  76th  - 73rd will each receive 2 points
•   Players  eliminated in positions 72nd  - 68th will each receive 3 points

and so on with each group of 4 players winning 1 more point than the players who are eliminated before them

•   Players  eliminated in positions 12th  - 9th eliminated will each receive 18 points
•   Players  eliminated in positions 8th - 5th will each receive 19 points
•   Players  eliminated in positions 4th  - 1st will each receive 20 points

You have this listed as an example, but it appears to be a completely different requirement.  I think to add this would be:

ceil(n / 4) - floor((r - 1) / 4)

Putting it all together:

1 + nb + (roundOut - 1) + ceil(n / 4) - floor((r - 1) / 4)

Correlating the teams will prove more difficult.  You could create 4 different leagues, one representing each team, and assign the players to the appropriate leagues.  Then create Stats Profiles, one for each league, then run stats for each league separately.  That at least will give you a "Sum" row, summing the Points (among other things).  Kind of a strange way to use the Stats, but whatever works.

Mahound

  • Sr. Member
  • ****
  • Posts: 395
  • THE ONLY time i get screwed is when i play poker!
    • View Profile
Re: Formula Help
« Reply #2 on: April 27, 2012, 03:20:26 PM »
thanks a lot Corey ingenius m8ty

Mahound

  • Sr. Member
  • ****
  • Posts: 395
  • THE ONLY time i get screwed is when i play poker!
    • View Profile
Re: Formula Help
« Reply #3 on: April 28, 2012, 09:11:53 AM »
This worked great. The formula works a treat,  just as you said.
However when I ran a mock tournament with 80 players (20 teams of 4).  I found that some points weren't added to the winners score.

In the section of the formula "Each player earns 1 point for every full level that they survive".

Example

In the mock tournament the winner knocked out the runner up in round 23.  So 23 points are awarded to the runner up, but as the winner is technically not eliminated from the game, the points that the winner should get for every level, is not added to the winners score.
Is there any way that these points could be added to the winners score.

Cheers

edit, i also added a switch into the formula, so this is what the end formula looked like
 1 + nb + (roundOut - 1) + ceil(n / 4) - floor((r - 1) / 4)+ switch(r, 1, 10, 2, 8, 3, 7, 4, 6, 5, 5, 6, 4, 7, 3, 8, 2)
« Last Edit: April 28, 2012, 09:39:05 AM by Mahound »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Formula Help
« Reply #4 on: April 28, 2012, 09:38:15 AM »
Add: + if(r = 1, roundNum)

I think that would work.  Only caveat would be if there was a final chop, in which case I think you'd just have to remove this part from the formula (since the first place finishers would have busted out due to the chop).

Mahound

  • Sr. Member
  • ****
  • Posts: 395
  • THE ONLY time i get screwed is when i play poker!
    • View Profile
Re: Formula Help
« Reply #5 on: April 28, 2012, 09:40:34 AM »
Add: + if(r = 1, roundNum)

I think that would work.  Only caveat would be if there was a final chop, in which case I think you'd just have to remove this part from the formula (since the first place finishers would have busted out due to the chop).

That was quick. thanks will try this ASAP

Mahound

  • Sr. Member
  • ****
  • Posts: 395
  • THE ONLY time i get screwed is when i play poker!
    • View Profile
Re: Formula Help
« Reply #6 on: April 28, 2012, 01:17:26 PM »
That was quick. thanks will try this ASAP

That worked great Corey Thank you very much.

As a point of interest Corey. How did you work this Formula out. Before posting this problem I spent quite some time looking through the help files for a solution to this. But I came no where near to what you arrived at.
« Last Edit: April 28, 2012, 03:25:48 PM by Mahound »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Formula Help
« Reply #7 on: April 28, 2012, 08:46:51 PM »
Well, you saw how I worked out most of it (pretty certain you already knew how to do most of it).  It was the "Round Out" part that was unique.  That particular piece of information has always been provided (it's a column on the Players tab and the Stats tab) since version 2.0.  I just looked to see if it was a formula variable.  And as it turns out, I added that formula variable in 3.0, and since the user manual for 3.0 isn't yet complete, you would have been hard pressed to find it (although it is listed here, but that's an unusual place to look).  And obviously you could not have known it was available in version 2, since it was only in my notes that it had actually been implemented (my notes said it was undocumented).

Quote
... but as the winner is technically not eliminated from the game ...

This had not occurred to me, but of course it is correct.  In a typical tournament, only one winner emerges, and the way the TD works the winner is declared once the 2nd place finisher is busted out, leaving the winner "still in" the tournament.  So of course, the "roundOut" variable will not be set, as the winner wasn't knocked out.  Just had to come up with another way to give the 1st place finisher points for each round he/she survived.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Formula Help
« Reply #8 on: April 28, 2012, 08:48:00 PM »
As a point of interest Corey. How did you work this Formula out. Before posting this problem I spent quite some time looking through the help files for a solution to this. But I came no where near to what you arrived at.

What this tells me is the user manual is important, and currently insufficient.  I'm working on it.