Article View: net.games.emp
Article #29famine
From: utzoodecvaxharpofloydcmcl2philab...
Date: Thu, 27 May 1982 01:41
Date: Thu, 27 May 1982 01:41
47 lines
1593 bytes
1593 bytes
Here is a famine that is a merge of the features of my previous
one and the one from unc!mp.
#! /bin/sh
: famine is a widget for empire.
: given a census report from empire
: it prints the minimum amount of
: food necessary for each sector and
: the difference between what is there
: and should be there. sectors that are
: below the minimum are flagged with
: an asterisk '*', sectors that are not
: self sustaining are flagged with a
: tilde '~'.
: these magic numbers were gleaned
: from "info food" and "info innards",
: they may need to be changed.
eatrate=0.048
fcrate=1.666
exec awk " {
if ( ( \$1 == \"sect\" ) && ( \$2 == \"eff\" ) && ( \$3 == \"mob\" ) )
print \$0 \" minf fdiff\"
else if ( ( \$1 ~ /[0-9],/ ) && ( \$3 ~ /[0-9]%\$/ ) ) {
cfield = NF-6 # field giving number of civilians
civ = \$(cfield)
mil = \$(cfield+1)
food = \$(cfield+2)
fert = \$(cfield+5)
pop = civ + mil
minf = pop * ${eatrate}
if ( minf < 1 )
minf = 1
fdiff = food - minf + 0.5
alert = \" \"
if ( ( mil > ${fcrate} * civ ) || ( pop > 2 * fert ) )
alert = \" ~\"
warn = \"\"
if ( food < minf )
warn = \"*\"
printf \"%s %4.0f %5d%s%s\n\", \$0, minf, fdiff, alert, warn
}
else
print
} " ${@}
Technical Details
Message-ID:
<bnews.sdcarl.303>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: utzoo!decvax!harpo!floyd!cmcl2!philabs!sdcsvax!phonlab!sdcatta!sdcattb!sdcarl!rusty Newsgroups: net.games.emp Title: famine Article-I.D.: sdcarl.303 Posted: Thu May 27 01:41:16 1982 Received: Sat May 29 01:56:34 1982 Subject: famine Date: Thu, 27 May 1982 01:41:16 +0000 Message-ID: <bnews.sdcarl.303>