Author Topic: Newbie - help formula  (Read 2188 times)

thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Newbie - help formula
« on: May 17, 2011, 03:12:57 AM »
1st : Sorry for my poor english

It's my first post but my club use TD since 2008.
Now, I would like to do a formula for the "points" automaticly
I've create a table, you can see here
Nombre de joueur = Number of player
And add point for 'hits" ex : 4 hits x 2 = 8 / 6 hits x 2 = 8 / etc...
He's there a way to do a formula, sorry but I'm very bad.
Thank you
regard.
« Last Edit: May 17, 2011, 03:22:03 AM by thierryhl »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Newbie - help formula
« Reply #1 on: May 17, 2011, 11:27:41 AM »
Implementing a table like this is a pain unless there are known equations for the various tiers.  Being poor at math, I don't know how to come up with an equation describing each.  But you can implement it in a more brute force way like this:

if(n = 21, switch(r, 178, 2, 49, 3, 32, 4, 23, 5, 16, 6, 12))
+ if(n = 22, switch(r, 182, 2, 51, 3, 34, 4, 23, 5, 17, 6, 13))
+ if(n = 23, switch(r, 186, 2, 54, 3, 36, 4, 24, 5, 17, 6, 13))
+ if(n = 24, switch(r, 190, 2, 57, 3, 37, 4, 25, 5, 18, 6, 13))
+ if(n = 25, switch(r, 194, 2, 60, 3, 39, 4, 26, 5, 18, 6, 13))
+ if(n = 26, switch(r, 1100, 2, 62, 3, 40, 4, 27, 5, 18, 6, 13))
+ if(n = 27, switch(r, 1103, 2, 65, 3, 42, 4, 28, 5, 19, 6, 13))
+ if(n = 28, switch(r, 1109, 2, 68, 3, 43, 4, 28, 5, 19, 6, 13))
+ if(n = 29, switch(r, 1114, 2, 70, 3, 45, 4, 29, 5, 19, 6, 13))
+ if(n = 30, switch(r, 1117, 2, 73, 3, 46, 4, 30, 5, 20, 6, 14))
+ if(n = 31, switch(r, 1100, 2, 64, 3, 44, 4, 31, 5, 24, 6, 19, 7, 15, 8, 13))
+ if(n = 32, switch(r, 1106, 2, 66, 3, 45, 4, 32, 5, 24, 6, 19, 7, 15, 8, 13))
+ if(n = 33, switch(r, 1109, 2, 69, 3, 47, 4, 33, 5, 25, 6, 19, 7, 15, 8, 13))
+ if(n = 34, switch(r, 1113, 2, 72, 3, 48, 4, 34, 5, 25, 6, 19, 7, 16, 8, 13))
+ if(n = 35, switch(r, 1116, 2, 74, 3, 50, 4, 35, 5, 26, 6, 20, 7, 16, 8, 13))
+ if(n = 36, switch(r, 1121, 2, 77, 3, 51, 4, 36, 5, 26, 6, 20, 7, 16, 8, 13))
+ if(n = 37, switch(r, 1125, 2, 79, 3, 53, 4, 37, 5, 27, 6, 20, 7, 16, 8, 13))
+ if(n = 38, switch(r, 1130, 2, 82, 3, 55, 4, 38, 5, 27, 6, 20, 7, 16, 8, 13))
+ if(n = 39, switch(r, 1134, 2, 84, 3, 56, 4, 38, 5, 28, 6, 21, 7, 16, 8, 13))
+ if(n = 40, switch(r, 1139, 2, 87, 3, 57, 4, 39, 5, 28, 6, 21, 7, 16, 8, 13))
+ if(n = 41, switch(r, 1121, 2, 77, 3, 53, 4, 39, 5, 30, 6, 24, 7, 20, 8, 17, 9, 15, 10, 14))
+ if(n = 42, switch(r, 1126, 2, 75, 3, 55, 4, 40, 5, 30, 6, 24, 7, 20, 8, 17, 9, 15, 10, 14))
+ if(n = 43, switch(r, 1130, 2, 82, 3, 56, 4, 41, 5, 31, 6, 24, 7, 20, 8, 17, 9, 15, 10, 14))
+ if(n = 44, switch(r, 1134, 2, 84, 3, 58, 4, 42, 5, 31, 6, 25, 7, 20, 8, 17, 9, 15, 10, 14))
+ if(n = 45, switch(r, 1137, 2, 87, 3, 59, 4, 42, 5, 32, 6, 25, 7, 21, 8, 18, 9, 15, 10, 14))
+ if(n = 46, switch(r, 1142, 2, 89, 3, 61, 4, 43, 5, 32, 6, 25, 7, 21, 8, 18, 9, 15, 10, 14))
+ if(n = 47, switch(r, 1145, 2, 92, 3, 62, 4, 44, 5, 33, 6, 26, 7, 21, 8, 18, 9, 15, 10, 14))
+ if(n = 48, switch(r, 1149, 2, 94, 3, 64, 4, 45, 5, 34, 6, 26, 7, 21, 8, 18, 9, 15, 10, 14))
+ if(n = 49, switch(r, 1153, 2, 97, 3, 65, 4, 46, 5, 34, 6, 26, 7, 21, 8, 18, 9, 16, 10, 14))
+ if(n = 50, switch(r, 1156, 2, 99, 3, 67, 4, 47, 5, 35, 6, 27, 7, 21, 8, 18, 9, 16, 10, 14))
+ (nh * 2)


Pretty ugly, but should work.

thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Newbie - help formula
« Reply #2 on: May 17, 2011, 02:14:38 PM »
thank you very much, i'll try tuesday

Magic_fubu

  • Hero Member
  • *****
  • Posts: 1035
    • View Profile
Re: Newbie - help formula
« Reply #3 on: May 17, 2011, 02:25:10 PM »
thierryhl,

If I may, I would suggest that you run a mock tournament before Tuesday to see if the formula works the way it's supposed to work. That way, in case it doesn't, we can help work out the kinks for you.
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!

thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Newbie - help formula
« Reply #4 on: May 18, 2011, 01:06:14 AM »
That's nice, but I'm on a Mac, I tried to find a PC today.

ps : If I make mistakes, you can correct me  ;)
thank you


regard

thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Newbie - help formula
« Reply #5 on: May 18, 2011, 02:09:44 AM »
you write

+ if(n = 46, switch(r, 1142, 2, 89, 3, 61, 4, 43, 5, 32, 6, 25, 7, 21, 8, 18, 9, 15, 10, 14))

but it's

+ if(n = 46, switch(r, 1,142, 2, 89, 3, 61, 4, 43, 5, 32, 6, 25, 7, 21, 8, 18, 9, 15, 10, 14))


thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Newbie - help formula
« Reply #6 on: May 18, 2011, 03:51:35 AM »
It work fine  ;)
It's possible to add a variable if a player is not in the league ?
thanx

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Newbie - help formula
« Reply #7 on: May 18, 2011, 10:48:33 AM »
you write

+ if(n = 46, switch(r, 1142, 2, 89, 3, 61, 4, 43, 5, 32, 6, 25, 7, 21, 8, 18, 9, 15, 10, 14))

but it's

+ if(n = 46, switch(r, 1,142, 2, 89, 3, 61, 4, 43, 5, 32, 6, 25, 7, 21, 8, 18, 9, 15, 10, 14))

Yep, I missed a comma with my search-and-replace.

It work fine  ;)
It's possible to add a variable if a player is not in the league ?
thanx

Yes, I believe it's the "inLeague" variable.  What do you want to do for players not in the league?

thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Newbie - help formula
« Reply #8 on: May 18, 2011, 01:22:12 PM »
Quote
Yes, I believe it's the "inLeague" variable.  What do you want to do for players not in the league?

No point for players who are not in the league.
sometimes we  have players who play just for pleasure

thanks so much for your time.

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 6220
    • View Profile
Re: Newbie - help formula
« Reply #9 on: May 18, 2011, 05:12:33 PM »
Put the entire formula in parentheses () and multiply the result by inLeague:

(if(n = 21, switch(r, 178, 2, 49, 3, 32, 4, 23, 5, 16, 6, ...
... + (nh * 2)) * inLeague

thierryhl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Newbie - help formula
« Reply #10 on: May 19, 2011, 02:40:34 AM »
Thank you Corey Cooper  ;)