Re: Army Composition

new topic     » goto parent     » topic index » view thread      » older message » newer message

Mike,

Unless I've done something wrong with your function, it doesn't return
exactly the correct values.  As I tested it, for a population of 10,000,
same command ratios CK used in his example (20, 10,10,5), your function
returns {9473,476, 47, 4,0}; but as CK pointed out for another routine, 476
can't be "supported" by 9473, the most that can be supported by 9473 is 473.

As far as I know, the code I sent earlier does result in the proper values.

CK,

Did you check my code?  Does it give values that seem correct? Do you need a
function?

Dan Moyer


----- Original Message -----
From: "Mike Nelson" <MichaelANelson at WORLDNET.ATT.NET>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, October 11, 2001 8:46 AM
Subject: Re: Army Composition


>
> CK,
>
> Perhaps this is what you are looking for  -- a function which does the
> calculation, to be embedded in your program:
>
> 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 the tiers, with 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
>    tiers=floor(pop/tiers)
>    for i=1 to num_tiers do
>       pop-=tiers[i]
>    end for
>    return pop & tiers
> end function
>
> -- Mike Nelson
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu