Re: Army Composition

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

C.K.,

Ok, how about this:

--<code begins>
include get.e
include misc.e


integer s, sql,lt,cp,gn, p
sequence quitYn

while 1 do
p = prompt_number("enter the population of soldiers: " , {0,1073741823} )

 s = floor(10000*p/10556)
 sql = floor(s/20)
 lt = floor(sql/10)
 cp = floor(lt/10)
 gn = floor(cp/5)

puts(1, "population: " & sprint(p) & "\n")
puts(1, "soldiers: " & sprint(s) & "\n")
puts(1, "squad leaders: " & sprint(sql) & "\n")
puts(1, "Lts.: " & sprint(lt) & "\n")
puts(1, "Cptns.: " & sprint(cp) & "\n")
puts(1, "Generals: " & sprint(gn) & "\n")
puts(1, "total: " & sprint( s + sql + lt + cp + gn) & "\n")

quitYn = prompt_string("quit, y/n?")
if equal("y", quitYn) then
   exit
end if


end while

--<code ends>

I would suggest you rethink your terms, though, because this is really an
ARMY, not a POPULATION;  a population of x could not support an army of x,
your civilian population must generally be larger than your army.

Also, the "excess" should probably be folded into the ranks of the soldiers,
I would think.  I didn't do that, I'll leave it to you, :)

Dan Moyer


----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, October 10, 2001 9:46 AM
Subject: Army Composition


>
> For a given population, what is the maximum number of persons at each
rank?
>
> Soldiers - no requirements
> Squad Leader - commands 20 soldiers
> Lt. - commands 10 Squad Leaders
> Captain - commands 10 Lt.s
> General - commands 5 Captains
>
> I need a EUPHORIA program to compute these values given a population.
>
> Who's got one?
>
> Thanks!
> ck
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu