Been meaning to come back with a clear head and try to understand this formula. I'm still not getting it.
So:
assign("PtRebuy",(abs(nr-1)))
PtRebuy is going to be, basically, one less rebuy than the player actually purchased. Except in the case that the player purchased no rebuys, in which case PtRebuy will be "1". (Which means PtRebuy will be "1" if the player bought 2 rebuys or 0 rebuys.)
Next,
if(PtRebuy=0, 1, ...
So, if the player bought 1 rebuy (in which case PtRebuy will be 0), then the player ends up with 1 point. Otherwise, they get points from this formula:
if(r<=mr,(((n + tnr) - r + 1 + nh + ((pw / pp) * (n+tnr))) * PtRebuy),((n + tnr) - r + 1 + nh)*PtRebuy)
Which says if the player is "in the money", they get points from this:
(((n + tnr) - r + 1 + nh + ((pw / pp) * (n+tnr))) * PtRebuy)
And if the player is NOT "in the money", then they get points from this:
((n + tnr) - r + 1 + nh)*PtRebuy))
I'm not even trying to figure out those last two (yet). I'm firstly confused by how PtRebuy is created. Why the abs()? And I guess, what's the overall goal?