	    Instructions for TradeWars 2002 Killer (TWKILLER)
			     by Ryan Gustafson
			  written August 14th, 1993

IMPORTANT NOTE:
	This program must be registered to take advantage of the feature 
discussed below.  At the end of this document you will find out how to get a 
registered version.  Please read the information about TWKILLER below before 
jumping to the registration section.  Afterward, run the program with the 
provided universe report files to see how it actually works and what it can 
do for you!  Finally, read the registration information.  Now:  Will you 
register it and get full capabilities?  Or, do you decide you do not want 
what this program has to offer?  If you really want this program, read the 
registration information at the end of the documentation.  If not, then 
thanks for checking it out.  In either case, please proliferate copies of 
this software so that others will have an opportunity to sample it.  Thanks!

The following files should be in the TWKILLER.ZIP file:

	TWKILLER.EXE   Main program
	TWKILLER.TXT   Documentation
	TWKILLER.SCT   Sector and Warp CIM file for included universe
	TWKILLER.PRT   Port CIM file for included universe
	HEADCUT1.DAT   Single Head sector bases for included universe
	HEADCUT2.DAT   Double Head sector bases for included universe
	EGAVGA.BGI     Graphics driver file
	IBM8514.BGI    Graphics driver file
	CIM.TXT        Computer Interrogation Mode start-up characters

	I would like to express my gratitude and thanks to Ann and Gary Martin 
for writing TradeWars 2002.  Without such a great game, I would never have
spent the time and effort to write this program.  Thanks!

-------------------------------------------------------------------------------
What it is:

	You have in your hands a program that will help you greatly in your 
play of the favorite of BBS games, TradeWars 2002.  I made this program 
because I could find no utility that would do this one special thing.  All 
modesty aside, I know of no other program that has this ability to the 
refined and exact extent of this program.  If there is a utility that does do 
this then I do not have it, and therefore someone has not been doing that 
simple little request in the last line of the "IMPORTANT NOTE" above (grin).
	The best utility program I know for TradeWars is TWVIEW by 
Robert Weaver.  That particular utility has many features, some of which I 
still haven't used.  I suggest you pick this program up if you want the best 
all around (and extras) utility package available.  Another alternative is a 
simple specialized program with a few of the most basic features, such as 
this program.
	Well, I guess I'll explain this mysterious feature I allude to.  It 
is the ability to find potential home bases in the universe, no matter if the 
universe is 30%, 75%, or 100% explored.  Let me define what I mean by a home 
base.  A home base consists of Head sectors and their corresponding Cut 
sectors.  The Head sectors are the lead (first or front) sectors to your 
base.  The Cut sectors are those which cannot be reached from the greater 
universe unless you first go through the Head sectors.  Simply put, Cut 
sectors are those that you cut off from the universe by choosing particular 
Head sectors.
-------------------------------------------------------------------------------
How it works:

	The program will run though the sectors 11 - 1000 (1-10 are always 
Federation Territory), removing each individually from the universe.  These 
are the potential Head sectors.  It will then find the sectors that cannot be 
reached after the Head sector has been removed.  These are the Cut sectors 
for that Head sector (a possible base then).  After all the bases are found, 
those bases that are subsets (contained in) of other bases are removed from 
the list.  So, the resulting list is of the largest possible bases.
	The program will do a base search with a single Head sector or with 
double Head sectors, depending on which you choose.  The single Head sector 
search is the standard search.  It takes a minimal amount of time.  The 
double Head sector search is more complex than the single search.  This 
search will find bases in which you have two Head sectors that determine a 
base, instead of only one sector.  To find all possible two Head sector bases 
takes about 500 times more calculation than to find all single Head sector 
bases, theoretically.  I have been able to shorten this considerably by some 
usefully exclusions, which are explained later.  It currently takes from 100 
to 150 times longer than a single Head sector search.  Processing time 
apparently depends on the speed the CPU is running at.  When I run my 486DX 
33Mhz at full tilt it takes about 110 times longer, when I switch to 16Mhz it 
takes about 130 times longer.  Use this in your judgment of computing times.  
The bases from the single Head sector search are written to the file 
HEADCUT1.DAT, and the bases from the double Head sector search are written to 
the file HEADCUT2.DAT.
	A few things to note about how the program works.  Unexplored sectors 
cannot be Head sectors or Cut sectors.  When the Head sectors are removed it 
is assumed that all the unexplored sectors in the universe can be reached.  
Since we have not explored them, they cannot give us data.  Therefore, the 
best route is to assume nothing of importance (assume they can be reached 
like most other sectors).  Thus, the bases that the program discovers are 
composed entirely of known universe sectors.  Yet they may have unexplored 
sectors adjacent to the explored sectors of the base.
	The major exclusion used to speed up the calculation is:  Head 
sectors for both the single and double base searches cannot be Cut sectors 
from the single Head sector search.  For this reason, you must first 
calculate a single Head sector base search before you will be allowed to do a 
double Head sector search.  During the double Head sector search, if one or 
both of the Head sectors are a Head sector in the single Head sector search, 
then the base is only used if the combination of the two Head sectors yields 
more Cut sectors than are contained in the single Head sector bases.  
Man... what a mess (grin).  It's not really all that important anyway.  
Another exclusion I use is:  In the double Head sector search, both of the 
Head sectors cannot be Cut sectors from the current list of double Head 
sector bases.  So... as the program progresses it should speed up slightly as 
fewer things need to be calculated.  NOTE:  I have not been able to explain to 
myself why this last exclusion is true.  It intuitively seems correct, yet I 
cannot precisely explain why.  If anyone out there knows whether my exclusion 
is correct or not PLEASE let me know.  I have tested the program with and 
without it.  In all cases so far it works, but there may be some special 
instance where it will not.  I hope that there is no such case where it will 
not work.  I want the program to be quick AND 100 percent accurate.
-------------------------------------------------------------------------------
After you used it:

	On to more intriguing things.  Once the program has found the bases 
there is an option to graphically view these bases.  This is the best part of 
the program.  When you chose this option you are first given an information 
screen.  Then a menu with which to change the parameters of the bases you are 
going to view.  You may loosely or strictly limit the bases you view using 
these parameters.  You can graphically view the bases only if you can support 
a graphics mode with more than two colors and have a resolution of at least 
640x200.  This software will not support black and white graphics modes, or 
modes having a vertical resolution of 320 pixels, such as CGA.  Due to the 
very poor viewing.  Also, the mouse routines are very ugly to use when you 
deviate from a vertical resolution of 640 pixels.
	The first parameter you can set is the number of sectors in the base.  
This includes the Head sector and all the Cut sectors.  The more sectors the 
better, as you have a larger base in which to put planets.  The second 
parameter is the maximum depth of the base.  This is determined by how far 
the most distant Cut sector is from the Head sector.  You want a large depth 
so that you can put many sectors of defense between your planets and the 
enemy.  The largest I have yet encountered is 10, although I'm sure there are 
deeper bases possible in some universes.  Imagine a depth of 15.  What a 
fortress (grin)!  The third parameter is the average sector depth, or the sum 
of the depths of each sector divided by the number of sectors.  This serves 
statistical purposes.  The previous parameters are sufficient for almost all 
purposes.
	The last three parameters are rather special and have Yes or No 
answers.  The first (fourth overall) has to deal with backdoors in your base.  
A backdoor is an escape hatch from your base; a sector with a one-way warp 
out of your base.  This is needed most when your enemies bottle you up in 
your base with mines and fighters.  Or how about several level five citadels?  
That's just a little extravagant and impractical (grin).  A draw back of 
backdoors is that the computer may route a traders course through your base.  
The second (fifth) parameter is a requirement for a loop in the base.  Most 
bases are trees that branch off, but occasionally you encounter a base that 
has a circular path in it (a loop).  These are found using a little formula 
of Euler's.  A loop can be a frustrating feature in that it is quite 
confusing if you don't have the base mapped out (i.e. How did I get here, 
again?)  This could mess your enemies up and you for that matter.  Ah... but 
you have it mapped out (grin)!  The third (sixth) parameter allows you to 
include or exclude those bases that have unexplored sectors adjacent to them.  
Remember how bases are determined... unexplored sectors are assumed to be 
reachable and they cannot be Head or Cut sectors.  So you can have a base 
with a Cut sector (explored) having an unexplored sector just next to it.  
This lets you know where potential bases are forming.  You just need to 
explore these unexplored sectors.  Some may lead to dead-ends which in turn 
make your base larger.  Others may lead into open space, which would 
eliminate that base the next time you determined the bases.
	Along with the aforementioned options, there is the option to switch 
between viewing the single or the double Head sector bases.  There is also 
the choice to write to file important information about each base.  The file 
will have all the sectors of the base listed, with the Head sectors first.  
The statistics of the base (i.e. number of sectors, maximum depth, and 
average depth), whether a base has a loop or a backdoor will be written to 
file.  At this time you cannot limit what is written to file.  Data for all 
the bases is written, so you have to edit the files yourself if you want to 
eliminate certain bases.  The data for the bases is written to the files 
BASEDAT1.TXT for the single Head sector bases and to BASEDAT2.TXT for the 
double Head sector bases.  The graphics viewing options are written to the 
file GRAPHICS.CFG.
	Once you have chosen your options you will be able to view the bases.  
You will see a little box in the upper left corner of the screen.  Containing 
three buttons; a plus, a minus, and an 'Exit'.  You can use these to scroll 
though the bases with a mouse, otherwise the '<' and '>' keys will work.  
These are in a 'Shift' position on my keyboard so ',' (comma) and '.' 
(period) will also work.  To 'Exit' press 'e' or hit 'Esc'.  You will note 
that there are dotted lines running vertically down the screen and numbers at 
the top of the lines.  These are to make determining the depth of a sector 
easy.  There is also a box across the bottom of the screen that will display 
statistics for each base and any special messages.
	This is a description of the symbols used in the graphics portion.  
On the extreme left of the screen you should see blue octagons with sector 
numbers in the middle.  These are the sectors that are next to the Head 
sectors, but not in the base.  If there are many of these sectors it is 
increasingly likely that someone will come across your base, particularly if 
you have defenses in the Head sectors.  It's all a matter of visibility.  
You may wish to recess your first defenses a sector if you have many of these 
sectors.  To the left of the blue octagons are four levels of red circular 
sectors.  These are the Head and front most Cut sectors.  The red is a 
cautionary sign, which decreases the further you are into the base.  After 
these red sectors are green sectors that represent a safe area in your base.  
Don't be too sure though, as NO base is absolutely safe, unless of course you 
have say 10 levels of defense (grin).  There are three other indicators as to 
sector properties.  The first is a blue ring around the base sectors.  This 
signifies the sector as having a backdoor (there could be more than one in 
that sector too).  The second is a yellow ring around a base sector.  This 
signifies there is an unexplored sector next to this sector.  Again, there is 
no indication of how many unexplored sectors there are next to this sector.  
The final indicator is a magenta arrow.  This indicates a one-way warp 
between sectors in the base.  The arrow points from the origin sector to the 
destination sector.  This means that if you are in the origin sector and move 
to the destination sector you cannot go directly back to the origin sector.  
This can be a real pain in particular bases.  For instance, in some bases 
there is a portion of the base separated from the rest of the base and it can 
only be left through a backdoor.  Not a very good choice.  An instance where 
these warps are not a problem is when you have a loop with this type of warp 
involved.
	When a base has a loop you will be notified in the status box by a 
simple message saying that the graph may be cluttered.  You might desire to 
draw it by hand to get a more clear picture.  The double Head sector bases 
can be particularly messy.  They usually have a horseshoe shape to them and 
sometimes their warp lines get messed around a bit.  The drawing algorithm 
was originally designed for the single Head sector bases, so, the double Head 
sector bases are not always drawn in the best presentable fashion.  You can 
often clear things up considerably by drawing the base by hand and 
rearranging a few things so warp lines cross each other less often.
-------------------------------------------------------------------------------
The other utility:

	Now that the 'unique' features of the program have been covered, the 
more mundane features can be discussed.  Almost all good TradeWars utilities 
have a utility to help you in your trading.  Who out there can keep track of 
the location of paired trading ports on all those little scraps of paper 
scattered around your computer desktop?  Let alone remember to which game 
they apply?  Not me!  Eh... or is it just me (grin)?  Well, I have written a 
simple little utility that will write to file all the important data you need.  
The first choice in the trading assistant will find all the paired ports in 
the known universe by class.  The location of the ports and the amount of 
commodities available for exchange will be written to file.  I rank paired 
ports by three classes.
	Class A: Equipment for Organics, by far the most profitable.
	Class B: Equipment for Fuel Ore
	Class C: Organics for Equipment, for that depleted universe.
All pairs are on two-way warp lanes.  There are no one-way warps.  Also, 
there is nothing from stopping a port from being listed in different classes 
(or even the same class) more than once.  It is up to you to decide how you 
should work your pairs to get the most profit.  This data is all written to 
the a file called TRADE.TXT.
	The second trading assistant option will allow you to find transwarp 
trading pairs.  These are pairs that many Good traders use with their ISS's 
after all the good paired ports are pounded into the ground.  The utility 
will ask you for a lower and upper bound for the distances you would like to 
compute.  The available distances are from 2 to 8.  I think anything over 8 
is too far to be of use.  The distance is how far apart the two ports are.  
Note that they are the same distance apart both ways (A to B, and B to A).  
The transwarp pairs are separated into three classes just as the paired ports.
	Class A: Ports 4 & 5, maximizes equipment and organics trading.
	Class B: Ports 4 & 1, maximizes equipment trading.
	Class C: Ports 5 & 2, maximizes organics trading.
Again, there are no restrictions stopping a port from being listed more than 
once.  It is still your responsibility to determine the most efficient 
trading route.  This data is written to files of the form TRANS?.TXT where 
'?' represents the distance that is calculated.  If you select a lower bound 
of 2 and an upper bound of 4, you will find the files TRANS2.TXT, TRANS3.TXT, 
and TRANS4.TXT.  I feel this is much better than one monstrous file with all 
the data clumped together.  Every time you run this option, all old files 
will be deleted.  This assures you will not have to guess which files are new 
or old.
	For those who don't know, transwarp trading uses the transwarp drive 
to warp back and forth between two ports.  You need to leave a fighter at 
each port so you have something to lock onto, otherwise you can kiss your 
expensive ISS good-bye (grin).  Nothing like blind warping into a port, 
especially when you KNOW there is one there!  Well, once you have these 
fighters deposited you pick up fuel ore at one of the ports and fill the rest 
of your holds with whatever the other port buys and hop over there to sell.  
You also need to calculate how much fuel ore you need for your warping, and 
determine the best way to pick up fuel ore so that you can carry as much of 
the more expensive commodities as possible to maximize your profits.
-------------------------------------------------------------------------------
It is simplicity itself:
(Sherlock Holmes)

	I have included an option to print out files made by this program.  
This should save you the hassle of running through directory lists.  All you 
need to do is select the file you want to print.  If the file has not been 
created (i.e. It does not exist.) then it will not print.  Very simple!  If 
it does... "Thar be print heads aflyin'!"
-------------------------------------------------------------------------------
Miscellaneous stuff:

1.  You can abort almost anything by pressing 'Esc', 'e', or 'E'.
2.  You can move through some screens by pressing 'Space' or 'Return'.
3.  The files HEADCUT1.DAT and HEADCUT2.DAT will not be overwritten until the 
    bases have been sorted.  So... you will not lose anything you previously 
    computed to an accidental selection of the base find option.  The data is 
    stored in temporary files until the final write.
4.  When choosing your lower and upper distances for the transwarp trading 
    find, hitting 'Enter' will accept the default value.
5.  The maximum number of Cut sectors in a base is 30.  If you find a base 
    with 30 sectors be sure to physically explore it (And jump for joy!).  
    The program may have missed a few of the final Cut sectors.  They are 
    stored in an array so anything over 30 will overflow it.  If I did 
    dynamic memory allocation it would have been a MESS!
6.  The maximum number of bases is 300.  Anything over this will overflow the 
    array and be lost.

-------------------------------------------------------------------------------
How to setup:

	TWKILLER uses the CIM (Computer Interrogation Mode) of the Crai 
Computer on board your ship.  This function will output the sector and port 
data for your known universe.  All you need to do is capture this output.  
Your communications software should have this ability.
	To activate the CIM of the Crai, send ASCII characters 200 through 
205 while you are in the computer mode on your ship (Press 'C' from the main 
menu in TradeWars).  They are Alt-200, Alt-201,...,Alt-205 (Hold Alt, type 
200, release, Hold Alt, type 201, release.).  An alternate method is to ASCII 
upload the file CIM.TXT while you are in the computer mode.  Once you are in 
the CIM, you need to get the computer to start spitting numbers!

1.  Start your capture, capture to TWKILLER.SCT or some other name.
2.  While in CIM, press 'I', this will start an output of sectors and warp 
    data.
3.  End the capture after the output is done.
4.  Start your capture, capture to TWKILLER.PRT or some other name.
5.  While in CIM, press 'R', this will start an output of port data.
6.  End the capture after the output is done.
7.  Press 'Q' to quit the CIM.

	You now have the information you need to use TWKILLER.  Remember that 
as you explore more of the universe your data set becomes more complete.  You 
should do a CIM report every once in a while.  Also, if you use the trading 
utilities you should do a CIM report often as the port data changes everyday 
(even hourly)!  TWKILLER must have the CIM reports as named above, so you may 
have to rename your capture files.  If you want to use TWKILLER for more than 
one TradeWars game, then you must make a directory for each game.
-------------------------------------------------------------------------------
Registration:

	This is where you really start to groan if you happen to like my 
program.  As with many shareware programs, to take full advantage of TWKILLER 
you need to register it.  If you are using a non-registered program, then 
certain restrictions will come into play.
	The non-registered program will work ONLY with the supplied universe 
report files.  Actually, the base find utility will just not work with 
anything but the supplied universe.  The trade utility and print options will 
work with ANY universe.  So... the program is not totally crippled, just the 
portion that I put the most effort into.  I did not want to send out a fully 
functional version of TWKILLER, or conversely a totally crippled version.  
Therefore, I came to what I feel is a happy medium.  The program is fully 
functional in all respects, but without the proper registration code you can 
use some features only with the supplied files.  This allows people to sample 
what can actually be done with the program.  You do not need to take the 
author on his word that the program actually does what he says.  You can test 
it yourself!

	If you do want to register this program then:
	
	Send $10 or $15, Check or Money Order (Do not send cash!) to:
	Please allow 3 weeks for checks to clear.

		Ryan Gustafson
		1915 Burtness Road
		Cook MN, 55723

		Phone: 1-218-666-5668

	If you send $10, I will mail you the information needed to get full 
functionality from TWKILLER.  If you send $15, I will send you the latest 
version of TWKILLER along with the registration information.
	If you have problems with TWKILLER, just write me or call, I will be 
happy to help if I can!  Please report any bugs you encounter!
	If you have ideas for improvements or new features for future 
versions please let me know.  I'm very interested in keeping TWKILLER alive 
and growing!  I hope it will work without modifications in future versions of 
TradeWars (grin).

	If you want to pick up the latest version of TWKILLER then call:
	
	BBS Name: Warlock's Castle running VBBS at 2400
	Sysop: Gandalf  (Gloria Lindrud)
	Phone: 1-612-428-4034

	This was my favorite BBS while I was in the Twin Cities area.  Be 
sure to check out the TradeWars game there.
-----------------------------------------------------------------------------
Legal Jabberwocky:

	I am not responsible for anything that may happen to your computer 
when you run this program.  If something happens... tough luck.  I did NOT 
purposely put it there.
	This is copyrighted software.  You may distribute this software in 
the original form.  If you wish to convert it to another compression format 
then go ahead.  But, all the original files must be included in unaltered 
format.
	You may do anything you want to this program for your OWN use.  Do 
not distribute it after you have altered it.
	If you are using a registered version of the program then it is 
registered only to you and for use by you.  You can make as many copies for 
simultaneous use as long as only you use them.
-------------------------------------------------------------------------------
Here's the story on TWKILLER development:

	During my freshman year at the University of Minnesota, Minneapolis, 
the Institute of Technology, I started BBSing.  I soon discovered TradeWars 
2002.  I was quickly addicted to this game!  Well, I was able to get four 
good months of playing time in.  Then after school was over I went home for 
the summer and am currently staying at my folks place.  I plan to take a year 
off from school to get some bearings.  So I have a bunch of time on my hands 
and had decided before I left the Twin Cities to write a TradeWars utility.  
Well, this is it!  After two computer science courses, an Introduction to 'C' 
course and a Discrete Mathematics course, I set out on my largest project 
ever.  I have spent nearly a month putting this program together, with a 
month of diversion half way through the project (grin), altogether about two 
months from start to finish.  And today I sit here writing the finishing 
touches on the documentation.  So... if you think I did a good job let me 
know.  If you encounter any bugs let me know!  I'm entirely new to this huge 
program stuff so all feedback is important!  You wouldn't believe how hard it 
is to bounce ideas off  of my family, none of whom are in anyway inclined 
towards Mathematics or Computers (grin).  Although they do deserve credit for 
the registration "scheme" and proofing this document.  Meanwhile, I'm going 
to start (continue?  Like it ever stops (grin)!) working on the next version 
of TWKILLER.
