Re: MLM Numbers Game
- Posted by Mike Nelson <MichaelANelson at WORLDNET.ATT.NET> Oct 12, 2001
- 406 views
Here is a correction of my previous function: function get_tiers(integer pop,sequence tiers) --tiers is a sequnce of ratios, first element is ratio of --lowest level of leaders to grunts, second is ratio --of second-lowest level of leaders to lowest level, etc. --returns a sequence one longer than tiers, with the number of --each rank from grunts on up. --No error checking is done. integer num_tiers num_tiers=length(tiers) if num_tiers=0 then return {pop} end if tiers[1]+=1 for i=2 to num_tiers do tiers[i]=tiers[i]*tiers[i-1]+1 end for for i=num_tiers to 1 by -1 do tiers[i]=floor(pop/tiers[i]) pop-=tiers[i] end for return pop & tiers end function -- Mike Nelson