This contains traveller archive messages 384, 719, 780, 823, and 899. It is up-to-date as of AMN 1119. It contains miscellaneous traveller programs. ------- Forwarded Messages Bundle: 36 Archive-Message-Number: 384 Date: Mon, 5 Jun 89 12:25:54 EDT From: ("William B. Morrison") morrison@pyr.gatech.edu Message-Id: <8906051625.AA15114@pyr.gatech.edu> To: traveller@dadla.LA.TEK.COM Subject: Update to real system generation program Reply-To: traveller-request@dadla.la.tek.com Resent-To: traveller-instant Approved: by traveller@dadla.la.tek.com Mon Jun 5 12:01:15 PDT 1989 Resent-Date: 05 Jun 89 12:01:24 PDT (Mon) Resent-From: James T. Perkins The following is an update to the program I recently mentioned that generates *real* star systems. This update fixes a problem with Suns, but should be implemented regardless. Many thanks go out to Jonathan Bayer (ispi!jbayer@uunet.UU.NET) who found the problem and the fix. The config.h file contains definitions that provide tailoring for specific hardware and operating systems. This file contains the following defines: > #ifdef SUN > #define LONG_RAND > #endif Here is Jonathan's fix: > I just found your problem on the Sun. The define shown above is in > config.h. However, config.h is included LAST in all the source files. > Since the LONG_RAND flag is used in consts.h, it is not being used > properly. Move all the #include "config.h" to be the first local file > included and your problem should go away. Also, Jonathan mentioned that he has some patches for the DOS version which I will forward as soon as I receive them. - --Bill Morrison Star System Generation Discussion Coordinator The Traveller Mailing List is a courtesy of James Perkins and Tektronix, Inc. All opinions and material above is the responsibility of the originator. Send Submissions To: @RELAY.CS.NET:traveller@dadla.LA.TEK.COM, uunet!dadla.la.tek.com!traveller, or traveller@dadla.la.tek.com List Administrator: traveller-request@dadla.la.tek.com ------- Message 2 Bundle: 65 Archive-Message-Number: 719 From: ("45252-Peter L. Berghold") wrgate.wr.tek.com!uunet.uu.net!allegra!violin!plb@tektronix.TEK.COM Message-Id: <8911161808.AA13326@violin> Subject: Postprocessor for the "ST" program To: (Traveller Mailing List) traveller@dadla.WR.TEK.COM Date: Thu, 16 Nov 89 13:08:08 EST Reply-To: wrgate.wr.tek.com!uunet.uu.net!att!violin!plb@tektronix.TEK.COM Resent-To: traveller-instant Approved: by traveller@dadla.wr.tek.com Thu Nov 16 12:06:37 PST 1989 Resent-Date: 16 Nov 89 12:06:57 PST (Thu) Resent-From: James T Perkins As I promised, here is the awk script set that I wrote to postprocess the ASCII output from the program "ST" into [et]roff compatible input specification. This will allow you to edit the information as you see fit and as well, add things to the information to make it more complete. The star map is rendered in PIC format as well. It probably could be greatly improved upon and I invite the programmers out there to hack away at it and come up with whatever improvements you can think of. The working script itself was written for the NAWK version of awk because of the ability to break the script up into modular units easier. In fact it almost is like programming in C! Enjoy! Pete #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by 45252-Peter L. Berghold on Thu Nov 16 13:02:45 1989 # # This archive contains: # README do_map do_map.awk # # Error checking via wc(1) will be performed. # Error checking via sum(1) will be performed. LANG=""; export LANG PATH=/bin:/usr/bin:$PATH; export PATH if sum -r /dev/null 2>&1 then sumopt='-r' else sumopt='' fi echo x - README sed 's/^@//' >README <<'@EOF' @@(#) @@(#)README 1.1 What is this program and why was it written? When I recieved a copy of the program "st" I was suitably impressed with it. However, being left with the choice of outputs of either text or postscript left a little to be desired. I wanted to be able to add comments and such to the resultant output and then print all this information via eroff to my laser printer. I even wanted the hex map for a subsector printed out as well. I began hacking at an awk script to do this for me, and the result after many hours of tweaking ended up being the product you see here. To use the script set you execute: do_map [seed number] > file -or- do_map [seed_number] | pic .... etc .... Some of my own complaints about this script: 1) Stars are not "shaded" in. In the postscript output facility of "st" the stars are filled in. I liked that. Unfortunately PIC has no way of doing this (boo hiss!). 2) No facility flags in the hexes. Maybe next release. 3) Stars are not centered. I don't know why. Pic is being ostreporous about this. I wholeheartedly release this set of scripts to the public domain. I don't claim that they are "the end", and probably could be improved upon greatly. Send all questions, complaints, bug reports, flowers and brickbats to: Peter L. Berghold AT&T Red Hill (201) 615-4419 UUCP: {uunet!allegra|att}!violin!plb @EOF set `sum $sumopt do_map <<'@EOF' #!/bin/ksh # # @(#) SRCID: @(#)do_map 1.1 # ######################################################################### ## ## Front end to the "do_map.awk" nawk program. Filter all the control-l's ## out and change them to ".bp"s before nawk is forced to process the ## output from st. ## ## st $* | sed "s/\ /.bp/g" | do_map.awk @EOF set `sum $sumopt do_map.awk <<'@EOF' #!/usr/bin/nawk -f ######################################################################## ## ## @(#) SRCID: @(#)do_map.awk 1.1 ## @(#) ## @(#) Author: Peter L. Berghold ## @(#) Released to the public domain on 11/16/89 ## ## @(#) do_map.awk -- Postprocess the output from the program st and ## @(#) change it into [nte]roff compatible input specs. ## ## BEGIN{ FirstHeader=1 # State for finding the first header Star=2; # Find the star Header=3; # Next header Sys=4; # Process the star system. SStab=5; # Subsector table SSmap=6; # Subsector map Swallow=7; # Swallow lines. ocount=0; # Orbit object count. STATE=FirstHeader printf ".nr Ej 1\n" printf ".PH \"\'IISS Survey Report\'\'UNCLASS\'\"\n" printf ".PF \"\'Information released to public\'[ %% ]" printf "\'Under the Freedom of Information Act\'\"\n" SysCount=0; Sysix=0; # An array containing the normalized coordinates for a hex map # hex vertices. hexx[1]=0.866; hexy[1]=0; hexx[2]=0.433; hexy[2]=0.75; hexx[3]=-0.433; hexy[3]=0.75; hexx[4]=-0.866; hexy[4]=0; hexx[5]=-0.433; hexy[5]=-0.75; hexx[6]=0.433; hexy[6]=-0.75; } END { hexmapstrt(); for(ix=0;ix 4 ) { for(ix=5;ix<=NF;ix++) Re[ix-4]=$(ix); cn=NF-4; } else cn=0; SSTabEntry(Loc,Name,Pr1,Pr2,cn,Re); STATE=SStab; } else ProcessBody(); next; } STATE==SStab{ ## if (substr($0,1,3) == ".bp") STATE=SSmap else { ## Process the SStab entry Loc=$1 Name=$2 Pr1=$3 Pr2=$4 if (NF > 4 ) { for(ix=5;ix<=NF;ix++) Re[ix-4]=$(ix); cn=NF-4; } else cn=0; SSTabEntry(Loc,Name,Pr1,Pr2,cn,Re); } } STATE==SSmap{ print ".TE" ## Process the SSmap entry STATE=Swallow; } STATE == Swallow { ## Gobble this line. } # # Subfunctions to use in processing the text file... function IssueTBhdr1() { HEX_ENTRY[SysCount]=substr($3,2,4); SysCount++; printf ".H 1 \"%s\"\n",substr($0,4,length($0)); StartTB(); return } function TBhdr() { EndTB(); HEX_ENTRY[SysCount]=substr($3,2,4); SysCount++; printf ".H 1 \"%s\"\n",substr($0,4,length($0)); StartTB(); return } function EndTB() { print ".TE"; return } function StartTB() { print ".TS"; printf "box,expand,tab(~);\ncsssss\nc|c|c|c|c|c\nc|n|n|l|l|l.\n"; return } function ProcessBody() { Porb=substr($0,4,2); Morb=substr($0,7,2); if (substr($0,5,1) != " " && ocount > 0) printf "_\n"; if ( substr($0,2,1) == "*" ) printf "*~"; else printf "~"; if (substr($0,11,11) == "EMPTY ORBIT") { printf "%d~~~EMPTY ORBIT\n",Porb; } else { ix=10; for(iy=10;substr($0,iy,1)!=" ";iy++); l=iy-ix; OName=substr($0,ix,l); ODes_p1=substr($0,27,7); ODes_p2=substr($0,36,1); Remarks=substr($0,37,length($0)); if ( substr($0,5,1) == " ") printf "~"; else printf "%d~",Porb; if ( substr($0,8,1) == " ") printf "~"; else printf "%d~",Morb; printf "%s~",OName; if ( substr($0,27,5) == "Small" ) printf "Small GG~"; else if ( substr($0,27,5) == "Large" ) printf "Large GG~"; else printf "%s-%s~",ODes_p1,ODes_p2; printf "%s\n",Remarks; } ocount++; return } function SSTabEntry(L,N,P1,P2,nc,r) { HexName[Sysix]=N; if ( P2 == "UNINHABITED" ){ printf "%s~%s~~UNINHABITED\n",L,N; HexProfile[Sysix]="UNINHABITED"; }else{ printf "%s~%s~%s-%s~",L,N,P1,P2; HexProfile[Sysix]=sprintf("%s-%s",P1,P2); if (nc > 0 ) for (ix=1;ix<=nc;ix++) printf "%s ",r[ix]; printf "\n" } Sysix++; return } # # # # Function to start the definition of the hex map macros and such. ############################################################################ function hexmapstrt() { print ".bp" print ".nf" print ".PS 5 8 " print "xmove=0.866" print "ymove=0.5" print "define Hex X" print "cx=$1" print "cy=$2" print "hexx1=0.577" print "hexy1=0" print "hexx2=0.289" print "hexy2=0.5" print "hexx3=-0.289" print "hexy3=0.5" print "hexx4=-0.577" print "hexy4=7.07e-17" print "hexx5=-0.289" print "hexy5=-0.5" print "hexx6=0.289" print "hexy6=-0.5" print "move to (cx+hexx1,cy+hexy1)" print "line to (cx+hexx6,cy+hexy6)" print "line to (cx+hexx5,cy+hexy5)" print "line to (cx+hexx4,cy+hexy4)" print "line to (cx+hexx3,cy+hexy3)" print "line to (cx+hexx2,cy+hexy2)" print "line to (cx+hexx1,cy+hexy1)" print "\"\\s-2$3$4\\s0\" at (cx,hexy3+cy) below" print "X" print "define MapSystem X" print " cx= $1 - 1 * xmove " print " if ( $1 % 2 == 0 ) then N" print " cy = 11 - ( ymove + $2 )" print " N else N" print " cy= 11- $2" print " N" print " move to (cx,cy)" print " circlerad= 0.1i" print " circle" print " namey=cy+( ( hexy3 - cy ) / 2.0 )" print " \"\\s-2$3\\s0\" at (cx,namey)" print " profy=cy - ( ( cy - hexy5 ) / 2.0 ) " print " \"\\s-2$4\\s0\" at (cx,profy)" print "X" print "define CreateMap X" print "Hex(0,10,01,01)" print "Hex(0,9,01,02)" print "Hex(0,8,01,03)" print "Hex(0,7,01,04)" print "Hex(0,6,01,05)" print "Hex(0,5,01,06)" print "Hex(0,4,01,07)" print "Hex(0,3,01,08)" print "Hex(0,2,01,09)" print "Hex(0,1,01,10)" print "Hex(0.866,9.5,02,01)" print "Hex(0.866,8.5,02,02)" print "Hex(0.866,7.5,02,03)" print "Hex(0.866,6.5,02,04)" print "Hex(0.866,5.5,02,05)" print "Hex(0.866,4.5,02,06)" print "Hex(0.866,3.5,02,07)" print "Hex(0.866,2.5,02,08)" print "Hex(0.866,1.5,02,09)" print "Hex(0.866,0.5,02,10)" print "Hex(1.73,10,03,01)" print "Hex(1.73,9,03,02)" print "Hex(1.73,8,03,03)" print "Hex(1.73,7,03,04)" print "Hex(1.73,6,03,05)" print "Hex(1.73,5,03,06)" print "Hex(1.73,4,03,07)" print "Hex(1.73,3,03,08)" print "Hex(1.73,2,03,09)" print "Hex(1.73,1,03,10)" print "Hex(2.6,9.5,04,01)" print "Hex(2.6,8.5,04,02)" print "Hex(2.6,7.5,04,03)" print "Hex(2.6,6.5,04,04)" print "Hex(2.6,5.5,04,05)" print "Hex(2.6,4.5,04,06)" print "Hex(2.6,3.5,04,07)" print "Hex(2.6,2.5,04,08)" print "Hex(2.6,1.5,04,09)" print "Hex(2.6,0.5,04,10)" print "Hex(3.46,10,05,01)" print "Hex(3.46,9,05,02)" print "Hex(3.46,8,05,03)" print "Hex(3.46,7,05,04)" print "Hex(3.46,6,05,05)" print "Hex(3.46,5,05,06)" print "Hex(3.46,4,05,07)" print "Hex(3.46,3,05,08)" print "Hex(3.46,2,05,09)" print "Hex(3.46,1,05,10)" print "Hex(4.33,9.5,06,01)" print "Hex(4.33,8.5,06,02)" print "Hex(4.33,7.5,06,03)" print "Hex(4.33,6.5,06,04)" print "Hex(4.33,5.5,06,05)" print "Hex(4.33,4.5,06,06)" print "Hex(4.33,3.5,06,07)" print "Hex(4.33,2.5,06,08)" print "Hex(4.33,1.5,06,09)" print "Hex(4.33,0.5,06,10)" print "Hex(5.2,10,07,01)" print "Hex(5.2,9,07,02)" print "Hex(5.2,8,07,03)" print "Hex(5.2,7,07,04)" print "Hex(5.2,6,07,05)" print "Hex(5.2,5,07,06)" print "Hex(5.2,4,07,07)" print "Hex(5.2,3,07,08)" print "Hex(5.2,2,07,09)" print "Hex(5.2,1,07,10)" print "Hex(6.06,9.5,08,01)" print "Hex(6.06,8.5,08,02)" print "Hex(6.06,7.5,08,03)" print "Hex(6.06,6.5,08,04)" print "Hex(6.06,5.5,08,05)" print "Hex(6.06,4.5,08,06)" print "Hex(6.06,3.5,08,07)" print "Hex(6.06,2.5,08,08)" print "Hex(6.06,1.5,08,09)" print "Hex(6.06,0.5,08,10)" print "X" print "CreateMap()" } function hexmapend() { print ".PE" printf ".FG \"Subsector Map\"\n"; printf ".fi\n" } @EOF set `sum $sumopt To: traveller Subject: Hex mapping algorithm Reply-To: jamesp@dadla.WR.TEK.COM (James T. Perkins) Date: 15 Jan 90 09:35:34 PST (Mon) From: jamesp Resent-To: traveller-instant Approved: by traveller@dadla.wr.tek.com Mon Jan 15 12:01:37 PST 1990 Resent-Date: 15 Jan 90 12:01:50 PST (Mon) Resent-From: James T Perkins This article looks appropriate. My policy is, in general, when someone posts something to USENET news, it can be redistributed to the list without explicit permission, as long as it remains completely intact. - ------- Forwarded Message From: Bertil Jonell Hi! I remember someone asked about algorithms for hex mapping a while back There is a posting on that by Jon Watte (d88-jwa@nada.kth.se) I repost it here and I hope he won't be mad at me (again :-) - - ------------------------------------------------------------------------------- Article 1220 of rec.games.programmer: Path: mathrt0.math.chalmers.se!chalmers!sunic!draken!d88-jwa From: d88-jwa@nada.kth.se (Jon Watte) Newsgroups: rec.games.programmer Subject: Re: hex map Message-ID: <2717@draken.nada.kth.se> Date: 13 Jan 90 14:00:57 GMT References: <157.25AEE023@metnet.FIDONET.ORG> Reply-To: d88-jwa@nada.kth.se (Jon W{tte) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 96 In article <157.25AEE023@metnet.FIDONET.ORG> bwood@f54.n147.z1.FIDONET.ORG (Barry Wood) writes: >A friend of mine is interested in any logarithms, etc that might help him ~~~~~~~~~~ Algorythms, I presume. (*I* don't have english for native language, so don't blame my spelling) 2 minutes of thought yields: A hex map can be represented in a plain 2d array. From now on I presume you are familiar with hex numbering: 0000 0002 0004 0001 0003 0100 0102 0104 0101 0103 0200 0202 0204 etc. One easily notes that every second column is half a hex lower down. This is no problem; just raise it: 0000 0001 0002 0003 0004 0100 0101 0102 0103 0104 etc. Now, to display this array (say, array[X_SIZ][Y_SIZ] of char) you use the following function: void display(a) char ** a; { int x, y; for(y=0; y Subject: hex map calculations To: (Traveller Mailing List) traveller@dadla.WR.TEK.COM Date: Mon, 22 Jan 90 11:46:58 EST Reply-To: traveller-request@dadla.wr.tek.com Resent-To: traveller-instant Approved: by traveller@dadla.wr.tek.com Mon Jan 22 12:06:37 PST 1990 Resent-Date: 22 Jan 90 12:06:43 PST (Mon) Resent-From: James T Perkins Not too long ago somebody asked who to go about creating hex maps with a computer. What follows is a rather "dirty"program that I wrote not too long ago to create subsector map grids with troff. It is written in C and is portable to MSDOS with the LATTICE C compiler. Its output should be fed through PIC before submitting to troff. I wholeheartedly make no claims on it whatsoever and it is free for all to use as they see fit. - ----------------------------> CUT HERE <-------------------------------------- #include #include #ifndef LATTICE #define CritAng ( (2 * M_PI) / 6.0 ) #else #define CritAng ( (2 * PI ) / 6.0 ) #endif main() { int Vertex; int ix,iy; double Radius; double Ymove; double Xmove; double x,y; FILE *fout; Radius= 0.5/sin( CritAng ); /* Sixty degree angle */ Xmove= Radius + ( cos( CritAng ) * Radius) ; Ymove= 2.0*cos (CritAng) * sin( CritAng / 2.0 ); /* Thirty Degrees */ fout=fopen("hex.pic","w"); fprintf(stdout,".PS 7 5 \n"); fprintf(stdout,"xmove=%.3g\n",Xmove); fprintf(stdout,"ymove=%.3g\n",Ymove); fprintf(stdout,"define Hex X\n"); fprintf(stdout,"cx=$1\ncy=$2\n"); for (Vertex=1; Vertex <= 6; Vertex++){ y= Radius * sin ( (double) (Vertex-1) * CritAng) ; x= Radius * cos ( (double) (Vertex-1) * CritAng) ; fprintf(stdout,"hexx%d=%.3g\n",Vertex,x); fprintf(stdout,"hexy%d=%.3g\n",Vertex,y); } fprintf(stdout,"move to (cx+hexx1,cy+hexy1)\n"); for(Vertex=6;Vertex>=1;Vertex--){ fprintf(stdout,"line to (cx+hexx%d,cy+hexy%d)\n",Vertex,Vertex); } fprintf(stdout,"\"\\s-2$3$4\\s0\" at (cx,hexy3+cy) below\n"); fprintf(stdout,"X\ndefine CreateMap X\n"); for(ix=1;ix<=8;ix++) for(iy=1;iy<=10;iy++){ if (ix%2 == 0 ) y=(double)iy + Ymove; else y=(double)iy; x=(double)(ix-1) * Xmove; y= 11-y; if ( iy < 10 ) fprintf(stdout,"Hex(%.3g,%.3g,0%d,0%d)\n",x,y,ix,iy); else fprintf(stdout,"Hex(%.3g,%.3g,0%d,%d)\n",x,y,ix,iy); } fprintf(stdout,"X\nCreateMap()\n\n.PE\n"); fclose(fout); } - -- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Peter L. Berghold */ /* System Administrator */ /* AT&T Red Hill Systems Administration Group */ /* 1F138 +1 (201) 615-4419 */ /* EMAIL (UUCP): {uunet!allegra|att}!violin!plb */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ All opinions and material above is the responsibility of the originator. Submissions: traveller@dadla.wr.tek.com, or uunet!dadla.wr.tek.com!traveller Administrator: traveller-request@dadla.wr.tek.com (James Perkins) The TML is made possible by facilities provided by Tektronix, Inc. ------- Message 5 Bundle: 83 Archive-Message-Number: 899 Date: Thu, 1 Feb 90 12:04:14 GMT From: (Jo Jaquinta) jaymin@maths.tcd.ie Subject: 1,000,000 stars To: traveller@dadla.WR.TEK.COM Message-Id: <9002011204.aa010831@hamilton.maths.tcd.ie> Reply-To: traveller-request@dadla.wr.tek.com Resent-To: traveller-instant Approved: by traveller@dadla.wr.tek.com Thu Feb 1 12:05:34 PST 1990 Resent-Date: 01 Feb 90 12:05:49 PST (Thu) Resent-From: James T Perkins The program in the following shell archive will allow one to explore a universe of over 1,000,000 stars. The idea was for it to be used as a campaign setting and would be ideal for anyone running a PBeM game on more than one world. The program should generate the same universe for everyone allowing mutual exploration and discussion. This program is level-1 and only generates mainworlds. Later levels will generate entire systems, geological data and all the way down to regional and city maps. If characteers can turn to their library data and pull up info on almost anywhere in the galaxy then why not the players? I don't mean to tread on the system-generation sublist's toes but this is rather different. Instead of a suite of programs to generate systems to suit the flexibility of individual's campaigns I have accepted rigidity for scope. The code is built in such a way that a host of subsidiary programs can be generated based on the central routines (sector maps, trade routes, ...). I have the later levels planned and specified but time pressure will delay their release. Any volunteers are most welcome. Jo Jaquinta jaymin@tcdmath.tcd.ie cut here - --------------------------><--><--><------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'exist.c' <<'END_OF_FILE' X#include "sysgen.h" X X#define abs(t) ((t<0L)?(-t):(t)) X Xint exist(x, y, z) Xlong x, y, z; X{ X int chance, roll; X long mag; X X mag = abs(x) + abs(y) + abs(z); X chance = 80 - (int)(80L*mag/GAL_RADIUS); X xyzmagic(x>>4, y>>4, z>>4, EXIST_MAGIC); /* sector density variation */ X chance += (rand()%40) - 20; X xyzmagic(x, y, z, EXIST_MAGIC); X roll = rand()%100; X if (roll > chance) X return(0); X chance /= 20; X if (++chance > 4) X chance = 4; X return(chance); X} END_OF_FILE if test 451 -ne `wc -c <'exist.c'`; then echo shar: \"'exist.c'\" unpacked with wrong size! fi # end of 'exist.c' fi if test -f 'lang.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'lang.c'\" else echo shar: Extracting \"'lang.c'\" \(2457 characters\) sed "s/^X//" >'lang.c' <<'END_OF_FILE' X#include "sysgen.h" X Xint olen[6] = { 19, 11, 5, 1, 0, 0 }; Xint oinitial[4] = { 5, 11, 8, 12 }; Xint ofinal[4] = { 17, 3, 8, 8 }; Xint ofcon[29] = { 10, 2, 13, 3, 9, 10, 2, 8, 2, 14, 2, 4, 13, 12, 6, 7, X 2, 2, 7, 10, 7, 3, 13, 21, 2, 9, 13, 3, 7 }; Xchar *afcon[29] = { "b", "br", "c", "ch", "d", "f", "fr", "g", "gr", "h", X "j", "k", "l", "m", "n", "p", "pl", "pr", "r", "s", "sh", "st", X "t", "th", "tr", "v", "w", "wh", "y" }; Xint ovowel[6] = { 49, 73, 40, 38, 7, 9 }; Xchar *avowel[6] = { "a", "e", "i", "o", "ou", "u" }; Xint olcon[29] = { 3, 3, 22, 5, 2, 3, 2, 3, 2, 5, 2, 4, 41, 9, 9, 2, X 3, 3, 36, 2, 2, 16, 2, 4, 21, 2, 3, 2, 3 }; Xchar *alcon[29] = { "c", "ck", "d", "f", "ft", "gh", "ht", "l", "ld", X "ll", "ly", "m", "n", "nd", "ng", "ns", "nt", "p", "r", "rd", X "rs", "s", "ss", "st", "t", "th", "w", "x", "y" }; X Xint len[6]; Xint initial[4]; Xint final[4]; Xint fcon[29]; Xint vowel[6]; Xint lcon[29]; X Xvoid seedlang(), drift(), scatter(); Xint lookup(); X Xvoid seedlang(x, y, z) Xlong x, y, z; X{ X int i; X X for (i = 0; i < 6; i++) X len[i] = olen[i]; X for (i = 0; i < 4; i++) X { X initial[i] = oinitial[i]; X final[i] = ofinal[i]; X } X for (i = 0; i < 6; i++) X vowel[i] = ovowel[i]; X for (i = 0; i < 29; i++) X { X fcon[i] = ofcon[i]; X lcon[i] = olcon[i]; X } X /* sector drift */ X xyzmagic(x>>6, y>>6, z>>6, LANG_MAGIC); X drift(); X /* sub-sector drift */ X xyzmagic(x>>4, y>>4, z>>4, LANG_MAGIC); X drift(); X /* local drift */ X xyzmagic(x, y, z, LANG_MAGIC); X drift(); X} X Xvoid drift() X{ X scatter(initial, 4, 6); X scatter(len, 6, 6); X scatter(final, 4, 6); X scatter(fcon, 29, 36); X scatter(vowel, 6, 36); X scatter(lcon, 29, 36); X} X Xvoid scatter(arr, max_arr, slide) Xint arr[], max_arr, slide; X{ X int i; X X while (slide--) X { X /* take one away */ X do { X i = rand()%max_arr; X } while (arr[i] == 0); X arr[i]--; X /* add back on */ X i = rand()%max_arr; X arr[i]++; X } X} X Xint lookup(arr, tot) Xint arr[]; Xint tot; X{ X int i; X X i = 0; X do { X tot -= arr[i++]; X } while (tot >= 0); X return(i - 1); X} X Xchar *getname() X{ X static char nbuf[40]; X int leng, type; X X leng = lookup(len, rand()%36) + 1; /* assume names one extra syllable */ X nbuf[0] = 0; X type = 0; X do { X type = lookup(type ? final : initial, rand()%36); X if (type%2) X { X strcat(nbuf, afcon[lookup(fcon, rand()%216)]); X } X strcat(nbuf, avowel[lookup(vowel, rand()%216)]); X if (type>1) X { X strcat(nbuf, alcon[lookup(lcon, rand()%216)]); X } X type = type/2; X } while (leng--); X return(nbuf); X} END_OF_FILE if test 2457 -ne `wc -c <'lang.c'`; then echo shar: \"'lang.c'\" unpacked with wrong size! fi # end of 'lang.c' fi if test -f 'magic.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'magic.c'\" else echo shar: Extracting \"'magic.c'\" \(532 characters\) sed "s/^X//" >'magic.c' <<'END_OF_FILE' X#include "sysgen.h" X Xvoid xyzmagic(x, y, z, magic) Xlong x, y, z, magic; X{ X long seed; X X x &= 0x07ff; X x <<= (32 - 11); X y &= 0x07ff; X y <<= (32 - 11 - 11); X z &= 0x03ff; X seed = x|y|z; X srand(seed + magic); X} X Xint D(n) X{ X int sum; X X sum = n; X while (n--) X sum += rand()%6; X return(sum); X} X Xstatic long randx; Xstatic char randf = 0; X Xvoid srand(seed) Xlong seed; X{ X randx = seed; X randf = 1; X} X Xunsigned int rand() X{ X if (!randf) X srand(1L); X randx = randx*1103515245L + 12345L; X return ((unsigned int)(((randx)>>16) & 0777777)); X} END_OF_FILE if test 532 -ne `wc -c <'magic.c'`; then echo shar: \"'magic.c'\" unpacked with wrong size! fi # end of 'magic.c' fi if test -f 'magic.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'magic.h'\" else echo shar: Extracting \"'magic.h'\" \(73 characters\) sed "s/^X//" >'magic.h' <<'END_OF_FILE' X#define GAL_RADIUS 100000L X X#define LANG_MAGIC 1L X#define EXIST_MAGIC 2L END_OF_FILE if test 73 -ne `wc -c <'magic.h'`; then echo shar: \"'magic.h'\" unpacked with wrong size! fi # end of 'magic.h' fi if test -f 'mainwrld.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mainwrld.c'\" else echo shar: Extracting \"'mainwrld.c'\" \(2303 characters\) sed "s/^X//" >'mainwrld.c' <<'END_OF_FILE' X#include "sysgen.h" X Xchar *strprt[4] = { X "AABBCCCDEEX", /* backwater */ X "AAABBCCDEEX", /* standard */ X "AAABBCCDEEE", /* mature */ X "AAAABBCCDEX" /* cluster */ X }; X Xint mainwrld(mw, x, y, z) Xmainworld *mw; Xlong x, y, z; X{ X int roll; X X roll = exist(x, y, z); X if (roll == 0) X return(0); X mw->starport = strprt[roll - 1][D(2) - 2]; X X mw->size = D(2) - 2; X X if (mw->size == 0) X mw->atmos = 0; X else X { X mw->atmos = D(2) - 7 + mw->size; X if (mw->atmos < 0) X mw->atmos =0; X } X X if (mw->size <= 1) X mw->hydro = 0; X else X { X roll = D(2) - 7 + mw->size; X if ((mw->atmos <= 1) || (mw->atmos >= 0xa)) X roll -= 4; X if (roll < 0) X mw->hydro = 0; X else if (roll > 10) X mw->hydro = 10; X else X mw->hydro = roll; X } X X mw->pop = D(2) - 2; X X mw->gov = D(2) - 7 + mw->pop; X if ((mw->pop == 0) || (mw->gov < 0)) X mw->gov = 0; X X mw->law = D(2) - 7 + mw->gov; X if ((mw->gov == 0) || (mw->law < 0)) X mw->law = 0; X X roll = D(1); X if (mw->starport == 'A') X roll += 6; X else if (mw->starport == 'B') X roll += 4; X else if (mw->starport == 'C') X roll += 2; X else if (mw->starport == 'X') X roll -= 4; X if (mw->size <= 1) X roll += 2; X else if (mw->size <= 4) X roll++; X if ((mw->atmos <= 3) || (mw->atmos >= 10)) X roll++; X if (mw->hydro >= 10) X roll += 2; X else if (mw->hydro >= 9) X roll++; X if ((mw->pop >= 1) && (mw->pop <= 5)) X roll++; X else if (mw->pop >= 10) X roll += 4; X else if (mw->pop >= 9) X roll += 2; X else if (mw->pop == 0) X roll = -99; X if ((mw->gov == 0) || (mw->gov == 5)) X roll++; X else if (mw->gov == 0xd) X roll -= 2; X if (roll < 0) X mw->tech = 0; X else X mw->tech = roll; X X mw->bases = 0; X if ((mw->starport == 'A') || (mw->starport == 'B')) X if (D(2) >= 8) X mw->bases |= NAVAL_BASE; X if ((mw->starport == 'A') && (D(2) >= 10)) X mw->bases |= SCOUT_BASE; X else if ((mw->starport == 'B') && (D(2) >= 9)) X mw->bases |= SCOUT_BASE; X else if ((mw->starport == 'C') && (D(2) >= 8)) X mw->bases |= SCOUT_BASE; X else if ((mw->starport == 'D') && (D(2) >= 7)) X mw->bases |= SCOUT_BASE; X if ((mw->starport == 'A') && (D(2) >= 10)) X mw->bases |= LOCAL_BASE; X else if ((mw->starport == 'B') && (D(2) >= 9)) X mw->bases |= LOCAL_BASE; X else if ((mw->starport == 'C') && (D(2) >= 8)) X mw->bases |= LOCAL_BASE; X X seedlang(x, y, z); X strcpy(mw->name, getname()); X return(1); X} END_OF_FILE if test 2303 -ne `wc -c <'mainwrld.c'`; then echo shar: \"'mainwrld.c'\" unpacked with wrong size! fi # end of 'mainwrld.c' fi if test -f 'readme' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'readme'\" else echo shar: Extracting \"'readme'\" \(860 characters\) sed "s/^X//" >'readme' <<'END_OF_FILE' X SYSTEM GENERATOR LEVEL 1 X RELEASE 0 X 1 February, 1990 X jaymin@maths.tcd.ie X X This code was written on a PC and tested under the Lattice-C, X Microsoft-C and Turbo-C compilers. It should work under most X C compilers but be careful of long arithmetic. I would be most X keen to know modifications that are needed for various compilers. X To check your executable is 100% correct the system at coordinates X 10000,10000,10000 should be: X C200100-a 10000 10000 10000 dete X I strongly encourage people to write subsidiary programs, e.g. X to map a subsector, plot trade routes, .... Usefull programs X will be added to later releases. X X Planed releases: (subject to bugs, help and excess revisions) X X Level-1: Main-world generation February X Level-2: Extended system generation March X Level-3: World builder's generation May X Level-4: Surface maps June END_OF_FILE if test 860 -ne `wc -c <'readme'`; then echo shar: \"'readme'\" unpacked with wrong size! fi # end of 'readme' fi if test -f 'sysgen.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sysgen.h'\" else echo shar: Extracting \"'sysgen.h'\" \(343 characters\) sed "s/^X//" >'sysgen.h' <<'END_OF_FILE' X#include "magic.h" X X#define MAX_NAME 40 X#define mainworld struct MW X X#define NAVAL_BASE 0x0001 X#define SCOUT_BASE 0x0002 X#define LOCAL_BASE 0x0004 X Xmainworld { X char name[MAX_NAME]; X char starport; X int size; X int atmos; X int hydro; X int pop; X int gov; X int law; X int tech; X int bases; X }; X Xchar *getname(); Xvoid srand(); Xunsigned int rand(); END_OF_FILE if test 343 -ne `wc -c <'sysgen.h'`; then echo shar: \"'sysgen.h'\" unpacked with wrong size! fi # end of 'sysgen.h' fi if test -f 'sysgen1.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sysgen1.c'\" else echo shar: Extracting \"'sysgen1.c'\" \(613 characters\) sed "s/^X//" >'sysgen1.c' <<'END_OF_FILE' X#include "sysgen.h" X Xvoid main(argc, argv) Xint argc; Xchar **argv; X{ X mainworld mw; X long x, y, z, atol(); X X if ((argc < 3) || (argc > 4)) X { X printf("Usage: sysgen X Y [Z]\n"); X exit(1); X } X x = atol(argv[1]); X y = atol(argv[2]); X if (argc == 4) X z = atol(argv[3]); X else X z = 0L; X X if (mainwrld(&mw, x, y, z) == 0) X exit(0); X printf("%c%1x%1x%1x%1x%1x%1x-%x %c%c%c %8ld %8ld %8ld %s\n", X mw.starport, mw.size, X mw.atmos, mw.hydro, mw.pop, mw.gov, mw.law, X mw.tech, (mw.bases&NAVAL_BASE)? 'N' : ' ', X (mw.bases&SCOUT_BASE)? 'S' : ' ', X (mw.bases&LOCAL_BASE)? 'M' : ' ', X x, y, z, mw.name); X exit(1); X} END_OF_FILE if test 613 -ne `wc -c <'sysgen1.c'`; then echo shar: \"'sysgen1.c'\" unpacked with wrong size! fi # end of 'sysgen1.c' fi echo shar: End of shell archive. exit 0 All opinions and material above is the responsibility of the originator. Submissions: traveller@dadla.wr.tek.com, or uunet!dadla.wr.tek.com!traveller Administrator: traveller-request@dadla.wr.tek.com (James Perkins) The TML is made possible by facilities provided by Tektronix, Inc. ------- End of Forwarded Messages