From: Burton Choinski (burt@ptltd.com)
Date: Wed 17 Nov 1993 - 01:07:34 EET
The following is another, small program you can feed your laserprinter.
What it does is populate an area based on the rules in Book 3. You can
fine tune the creation of new cities and the like, and it seems to do a
pretty good job, from what I have noticed so far.
If you have any comments on it, just mail me and let me know.
Program begins with the next line, cut all text before (including this one)
%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Populator.ps %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Configure the known information here%% EXAMPLE: Set for Loskalm, based on the Genertala Book %%
/MET 0 def % # of metropoli on the map
/LC 5 def % # of large cities on the map
/MC 3 def % # of medium cities on the map
/SC 0 def % # of small cities on the map
/TC 0 def % # of towns on the map
/POP 3200000 def % Total population listed for the region
/CLOSE -1 def % How close to the map? (see below)
%% The CLOSE variable indicates how close you want to be the map. %% -2: Generate cities less than known ones only %% -1: Generate cities less than or equal to known ones %% 0: May generate additional (or new) anything %% 1: May not create additional Metropoli %% 2: May not create additional Metropoli or Large Cities %% 3: May not create additional Metropoli, Large or Medium Cities %% 4: May not create additional Metropoli or any cities -- townships only %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usertime srand
/RND {rand 1000000 mod 999999 div mul cvi 1 add} bind def
/EA [] def /LA [] def /MA [] def /SA [] def /TA [] def
POP /tot exch def
%% Allocate Noted Sites
MET {
0 {6 RND dup 6 eq {pop 5 add} {add exit} ifelse} loop
5 add 5000 mul 11 RND 6 sub 500 mul add dup tot exch sub /tot exch def
EA aload length 1 add array astore /EA exch def
} repeat
LC {
5 RND 5000 mul 11 RND 6 sub 500 mul add dup tot exch sub /tot exch def
LA aload length 1 add array astore /LA exch def
} repeat
MC {
4 RND 4 RND add 1000 mul 11 RND 6 sub 100 mul add dup tot exch sub
/tot exch def MA aload length 1 add array astore /MA exch def
} repeat
SC {
6 RND 500 mul 11 RND 6 sub 50 mul add dup tot exch sub
/tot exch def SA aload length 1 add array astore /SA exch def
} repeat
CLOSE -1 eq {
TC 0 gt {/CLOSE 4 def} if
SC 0 gt {/CLOSE 3 def} if
MC 0 gt {/CLOSE 2 def} if
LC 0 gt {/CLOSE 1 def} if
CLOSE -2 eq {
SC 0 gt {/CLOSE 4 def} if
MC 0 gt {/CLOSE 3 def} if
LC 0 gt {/CLOSE 2 def} if
%% Find Metropoli... (NOTE: Only if in "new" mode
CLOSE 0 eq {
tot EA {20 mul sub} forall /tmp exch def
{
0 {6 RND dup 6 eq {pop 5 add} {add exit} ifelse} loop
5 add 5000 mul 11 RND 6 sub 500 mul add dup 20 mul tmp gt {pop exit} {
dup tot exch sub /tot exch def dup 20 mul tmp exch sub /tmp exch def
EA aload length 1 add array astore /EA exch def MET 1 add /MET exch def
} ifelse
%% Find Large Cities...
CLOSE 2 lt {
tot LA {15 mul sub} forall /tmp exch def
{
5 RND 5000 mul 11 RND 6 sub 500 mul add dup 20 mul tmp gt {pop exit} {
dup tot exch sub /tot exch def dup 15 mul tmp exch sub /tmp exch def
LA aload length 1 add array astore /LA exch def LC 1 add /LC exch def
} ifelse
%% Find Medium Cities...
CLOSE 3 lt {
tot MA {10 mul sub} forall /tmp exch def
{
4 RND 4 RND add 1000 mul 11 RND 6 sub 100 mul add dup 10 mul tmp gt {pop exit} {
dup tot exch sub /tot exch def dup 10 mul tmp exch sub /tmp exch def
MA aload length 1 add array astore /MA exch def MC 1 add /MC exch def
} ifelse
%% Find Small Cities...
CLOSE 4 lt {
tot SA {5 mul sub} forall /tmp exch def
{
6 RND 500 mul 11 RND 6 sub 50 mul add dup 5 mul tmp gt {pop exit} {
dup tot exch sub /tot exch def dup 5 mul tmp exch sub /tmp exch def
SA aload length 1 add array astore /SA exch def SC 1 add /SC exch def
} ifelse
%% Find Towns...
tot TA {2 mul sub} forall /tmp exch def
{
8 RND 2 add 100 mul 11 RND 6 sub 10 mul add dup 2 mul tmp gt {pop exit} {
dup tot exch sub /tot exch def dup 2 mul tmp exch sub /tmp exch def
TA aload length 1 add array astore /TA exch def TC 1 add /TC exch def
} ifelse
50 725 moveto
/Helvetica findfont 20 scalefont setfont
AREA show
50 700 moveto
/Helvetica findfont 15 scalefont setfont
(Total Population: ) show POP 10 string cvs show
50 675 translate
/Helvetica findfont 10 scalefont setfont 0 0 moveto (# of Metropoli: ) show MET 10 string cvs show MET 0 gt {
0 -8 translate 0 0 moveto /Helvetica findfont 6 scalefont setfont
0 EA {dup 10 string cvs dup stringwidth pop currentpoint pop add 500 gt {
0 -6.5 translate 0 0 moveto
} if
show ( ) show add} forall 0 -10 translate 10 0 moveto
/Helvetica findfont 8 scalefont setfont
10 string cvs show ( total population) show 0 -20 translate
} {
0 -20 translate
/Helvetica findfont 10 scalefont setfont 0 0 moveto (# of Large Cities: ) show LC 10 string cvs show LC 0 gt {
0 -9 translate 0 0 moveto /Helvetica findfont 6 scalefont setfont
0 LA {dup 10 string cvs dup stringwidth pop currentpoint pop add 500 gt {
0 -6.5 translate 0 0 moveto
} if
show ( ) show add} forall 0 -10 translate 10 0 moveto
/Helvetica findfont 8 scalefont setfont
10 string cvs show ( total population) show 0 -20 translate
} {
0 -20 translate
/Helvetica findfont 10 scalefont setfont 0 0 moveto (# of Medium Cities: ) show MC 10 string cvs show MC 0 gt {
0 -9 translate 0 0 moveto /Helvetica findfont 6 scalefont setfont
0 MA {dup 10 string cvs dup stringwidth pop currentpoint pop add 500 gt {
0 -6.5 translate 0 0 moveto
} if
show ( ) show add} forall 0 -10 translate 10 0 moveto
/Helvetica findfont 8 scalefont setfont
10 string cvs show ( total population) show 0 -20 translate
} {
0 -20 translate
/Helvetica findfont 10 scalefont setfont 0 0 moveto (# of Small Cities: ) show SC 10 string cvs show SC 0 gt {
0 -9 translate 0 0 moveto /Helvetica findfont 6 scalefont setfont
0 SA {dup 10 string cvs dup stringwidth pop
currentpoint pop add 500 gt {0 -6.5 translate 0 0 moveto
} if 1 index 1000 lt {(0) stringwidth pop 0 rmoveto} if
show ( ) show add} forall
0 -10 translate 10 0 moveto
/Helvetica findfont 8 scalefont setfont
10 string cvs show ( total population) show 0 -20 translate
} {
0 -20 translate
/Helvetica findfont 10 scalefont setfont 0 0 moveto (# of Townships: ) show TC 10 string cvs show TC 0 gt {
0 -9 translate 0 0 moveto /Helvetica findfont 6 scalefont setfont
0 TA {dup 10 string cvs dup stringwidth pop
currentpoint pop add 500 gt {0 -6.5 translate 0 0 moveto
} if 1 index 1000 lt {(0) stringwidth pop 0 rmoveto} if
show ( ) show add} forall
0 -10 translate 10 0 moveto
/Helvetica findfont 8 scalefont setfont
10 string cvs show ( total population) show 0 -20 translate
} {
0 -20 translate
/Helvetica findfont 10 scalefont setfont 0 0 moveto (Remaining population of ) show tot 10 string cvs show ( in villages and hearths) show
showpage
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- Burton
---------------------
This archive was generated by hypermail 2.1.7 : Fri 10 Oct 2003 - 01:32:21 EEST