User Tools

Site Tools


Star Trek/Space War is a text-based strategy game inspired by the television series Star Trek and popular on minicomputers, mainframes, and early PCs in the 1970s and -80s. It was originally programmed in 1971 by high-schooler Mike Mayfield for the SDS Sigma 7 mainframe. The TWENEX version of the program is based on David Ahl's DEC BASIC port[*], which Ahl distributed under the name of Space War (file name SPACWR.BAS).

The Instructions section below duplicates the original in-game help text, which Ahl adopted unchanged from Mayfield's source. In addition to adapting the text format, minor corrections have been made to spelling and punctuation. In the game, commands are selected by the number indicated in the headings below (this page's table of contents can serve as a quick command guide).

There are two commands not documented below:

  • Command 8 – to quit the game.
  • (Any other number) – to display a short list of valid commands.


To play Star Trek, log-in to your TWENEX account, enter BASIC, then run the following commands:



The galaxy is divided into an 8,8 quadrant grid which is in turn divided into an 8,8 sector grid.

The cast of characters is as follows:

 <*> = Enterprise
 +++ = Klingon
 >!< = Starbase
  *  = Star

Command 0 = Warp Engine Control

Course is in a circular numerical vector arrangement as shown.

    4  3  2
     \ ^ /
   5 ----- 1
     / ^ \
    6  7  8

Integer and real values may be used. Therefore course 1.5 is half way between 1 and 2.

A vector of 9 is undefined, but values may approach 9.

One warp factor is the size of one quadrant. Therefore to get from quadrant 6,5 to 5,5 you would use course 3, warp factor 1.

Command 1 = Short Range Sensor Scan

Print the quadrant you are currently in. Including stars, Klingons, starbases, and the Enterprise, along with other pertinant information.

Command 2 = Long Range Sensor Scan

Shows conditions in space for one quadrant on each side of the Enterprise in the middle of the scan. The scan is coded in the form XXX, where the units digit is the number of stars, the tens digit is the number of starbases. The hundreds digit is the number of Klingons.

Command 3 = Phaser Control

Allows you to destroy the Klingons by hitting him with suitably large numbers of energy units to deplete his shield power. Keep in mind that when you shoot at him, he gonna shoot at you, too!

Command 4 = Photon Torpedo Control

Course is the same as used in warp engine control. If you hit the Klingon, he is destroyed and cannot fire back at you. If you miss, you are subject to his phaser fire.

Note: The library computer (Command 7) has an option to compute torpedo trajectory for you (Option 2).

Command 5 = Shield Control

Defines number of energy units to be assigned to shields. Energy is taken from total ship's energy. Note that total energy includes shield energy.

Command 6 = Damage Control Report

Gives state of repairs of all devices. A state of repair less than zero shows that the device is temporarily damaged.

Command 7 = Library Computer

The library computer contains three options:

Option 0 = Cumulative Galactic Record

Which shows computer memory of the results of all previous long range sensor scans.

Option 1 = Status Report

Which shows number of Klingons, stardates, and starbases left.

Option 2 = Photon Torpedo Data

Gives trajectory and distance between the Enterprise and all Klingons in your quadrant.


[*] Minor incompatibilities between DEC BASIC and TWENEX's BASIC-10 required some modification of the source code:

  • Arguments removed from calls to function RND
  • Multiple colon-separated statements per line split into multiple single-statement lines.
  • Semicolons inserted between items in PRINT statements.
tutorials/startrek.txt · Last modified: 2016/10/17 04:44 by papa