# Star Trek (1971 video game)

Star Trek is a text-based strategy video game based on the Star Trek television series (1966–69) and originally released in 1971. In the game, the player commands the USS Enterprise on a mission to hunt down and destroy an invading fleet of Klingon warships. The player travels through the 64 quadrants of the galaxy to attack enemy ships with phasers and photon torpedoes in turn-based battles and refuel at starbases. The goal is to eliminate all enemies within a random time limit.
Mike Mayfield wrote the game in the BASIC programming language for the SDS Sigma 7 mainframe computer with the goal of creating a game like Spacewar! (1962) that could be played with a teleprinter instead of a graphical display. He then rewrote it for the HP 2000C minicomputer in 1972, and it was included in Hewlett-Packard's public domain software catalog the following year. It was picked up from there by David H. Ahl, who ported it with Mary Cole to BASIC-PLUS and published the source code in the Digital Equipment Corporation Edu newsletter. It was republished with other computer games in his best-selling 101 BASIC Computer Games book. Bob Leedom then expanded the game in 1974 into Super Star Trek.
Ahl left DEC and started Creative Computing magazine in 1974. He began porting the games from 101 to Microsoft BASIC, with the exception of Star Trek, where he ported Leedom's version rather than Mayfield's original. The result was released in 1978 under the new name BASIC Computer Games, just as the first microcomputers able to run the game were coming to market. BASIC Computer Games went on to become the first million-selling computer book, and versions of the game were available for almost all personal computers of the era. Additionally, dozens of variants and expansions were made for a variety of other systems, based either on Leedom's or the original Mayfield versions.

## Gameplay

Star Trek is a text-based strategy video game based on the Star Trek television series in which the player, controlling the USS Enterprise starship, flies through the galaxy and hunts down Klingon warships within a time limit. The game starts with a short text description of the mission before allowing the player to enter commands. Each game starts with a different number of Klingons, friendly starbases, and stars spread throughout the galaxy. The galaxy is depicted as an 8-by-8 grid of "quadrants". Each quadrant is further divided into an 8-by-8 grid of "sectors". The number of stars, Klingons, and starbases in any one quadrant is set at the start of the game, but their exact position changes each time the player enters that quadrant.
The player can view a text-based map of the current quadrant by issuing the short-range scan command. Stars, Klingon ships, starbases, and the Enterprise itself are shown as text-based figures in a square grid; the Enterprise, for example, is represented with -E-. The player can also use the long-range scan to print out a map of the quadrants lying directly around the Enterprise, with a list of the number of stars, Klingons, and starbases in each quadrant. The player moves between and within quadrants with the warp drive.
Klingon ships can be attacked with either phasers or photon torpedoes. Phasers do not have to be aimed, but their power and therefore damage amount falls off with distance, and the player must select how much power to put into each shot. Torpedoes do not suffer this drop in power and will destroy a Klingon ship with a single hit, but have to be aimed using polar coordinates. Later versions of the game expanded on this combat system by adding features such as Klingon ships moving after each shot if not destroyed, enemy attacks damaging systems such as scanners or shields, stars absorbing torpedoes that hit them, and a calculator to help in determining the proper angle to fire the torpedoes. Combat is turn-based, and Klingon ships will fire back at the player in their turn.
Movement, combat, and shields all drain the energy supply of the Enterprise, which can be restored by flying to a starbase. In some versions of the game, there are additional options for emergency situations, such as calling for help from a starbase, using the experimental Death Ray, loading raw dilithium crystals into the warp drive, or abandoning ship. Movement commands take up time depending on how far the player is moving. The game ends when the Enterprise is destroyed, all Klingons are destroyed, or the time limit runs out. A score in the form of a ranking is presented at the end of the game based on energy usage, damage taken and inflicted, and any remaining time.

## Development
### Star Trek

In 1971, Mike Mayfield, then in his final year of high school, frequented a computer lab at the University of California, Irvine, while teaching himself how to program. The lab operated both a SDS Sigma 7 and a DEC PDP-10 mainframe computer. The PDP-10 hosted a copy of Spacewar!, a multiplayer space combat video game developed in 1962 in the early history of video games. Mayfield had gained illicit access to the Sigma 7 at the lab and wanted to create his own version of the game for the system. Spacewar! required a vector graphics display, however, and the Sigma 7 only had access to a non-graphical Teletype Model 33 ASR teleprinter.
Mayfield decided to create a game in the vein of Spacewar! that could be played on a teleprinter and brainstormed several ideas with his friends. As none of the group had much experience with computers, most of the ideas were unfeasible, but one concept he liked and thought was possible was a game based on Star Trek, then in syndication on television. The concept included the game printing a map of the galaxy and a map of the local star system, and phaser weapons whose attack power declined over distance. Mayfield began to program the game, creating a punched tape of the game at the end of each programming session and loading it back into the computer the next day. He worked on the game through the rest of the school year and into the summer after graduating.
Later that summer, Mayfield purchased an HP-35 calculator and often visited the local Hewlett-Packard sales office. The staff there offered to let him use the HP 2000C minicomputer at the office if he would create a version of his Star Trek game for it; as the version of the BASIC programming language on the computer was different from the Sigma 7, he elected to abandon the Sigma 7 version and rewrite the program from scratch. He completed it on October 20, 1972, and the game was added to the HP public domain Contributed Program library of software as STTR1 in February 1973, with Mayfield attributing the game to Centerline Engineering, a company he was considering starting. It was also published in the People's Computer Company newsletter, and republished in their collection book, What to Do After You Hit Return (1975).
David H. Ahl was an employee in the education department of Digital Equipment Corporation (DEC). He had begun the Edu newsletter where user-submitted games became a major draw. He and fellow employee Mary Cole ported STTR1 to DEC's BASIC-PLUS in the summer of 1973, with some additions, and he published this version in the newsletter. Ahl attributed the game to "Mike Mayfield of Centerline Engineering and/or Custom Data". In late 1973, Ahl collected many of the game submissions in the book 101 BASIC Computer Games, containing descriptions and the source code for many early mainframe games. 101 BASIC Computer Games was a landmark title in computer games programming, and was a best-selling title with more than 10,000 copies sold — more copies than there were computers in existence at the time. As such, the BASIC ports of mainframe computer games included in the book were often more long-lived than their original versions or other mainframe computer games. He included Star Trek in the book as SPACWR, i.e. Space War.

### Super Star Trek

In early 1974, Bob Leedom saw Ahl's version of the game in 101 BASIC Computer Games while working with a Data General Nova 800 minicomputer at Westinghouse Electric Corporation and, having never seen a Star Trek game before, started porting it to the system. After he got the game running, he began to expand it with suggestions from his friends. He changed the user interface, replacing the original game's numeric codes with three-letter commands and adding status reports from show characters and names for the galaxy quadrants, and overhauled the gameplay, adding moving Klingon ships, navigation and fire control options, and an expanded library computer. Once it was completed, he wrote a letter to the People's Computer Company newsletter describing the game.
Ahl, who by then had left DEC to start Creative Computing magazine, saw Leedom's description in the newsletter and contacted him to publish the game in his magazine. Ahl ported it to Microsoft BASIC and published the source code of the game as Super Star Trek to distinguish it from the original Star Trek game, calling it "by far the best" version. He later included it under that name in the 1976 anthology The Best of Creative Computing as well as the 1978 edition of 101 BASIC Computer Games, retitled BASIC Computer Games. He added a note that he had permission from the rights holders to use the show's name in the title alongside a longer note written by Leedom explaining why the galaxy had 64 quadrants even though the term suggested there should only be four. BASIC Computer Games was the first million-selling computer book, giving Leedom's version a much wider audience than Mayfield and Ahl's original versions.

## Reception and legacy

   Everybody under the sun has been programming games based loosely on Star Trek.
Star Trek, especially the Super Star Trek version, was immensely popular for the era. By 1975 it had spread to mainframes across the United States, and Ahl stated in 1978 in BASIC Computer Games that it was difficult to find a computer installation that did not contain a version of Star Trek. By 1980, Star Trek was described by Mark Herro in The Dragon magazine as "one of the most popular (if not the most popular) computer games around", with "literally scores of different versions of this game floating around". At least one published work of fiction that year mentioned the game, the short story "Another Game of Spacewar", published in an anthology by Creative Computing. A 2013 overview of the game and its myriad versions in The Register by Tony Smith concluded that "like most games of the period it was fun to play once or twice, but it lacked staying power." Regardless, for the players of the time period when it was released, it was "a shiny new gateway to 'strange new worlds'".
The widespread popularity of the game, especially Super Star Trek, along with the availability of the source code, led to numerous ports of both versions of the game for mainframe and microcomputers. Alternate versions of the game were also produced, based on Star Trek, Super Star Trek, or both. David Matuszek and Paul Reynolds wrote an expanded Fortran version of the original game as UT Super Star Trek; Eric Allman ported this version to the C programming language to become BSD Trek, which is still included in the Debian classic Unix games package. BYTE published a BASIC version by David Price in March 1977 that used the original command system based on numbers. In 1983 BYTE columnist Jerry Pournelle claimed to have written "the world's most complex Star Trek game" in CBASIC. A shareware version for MS-DOS, EGATrek, was released in the late 1980s that replaced the original text-based screens with basic graphics that implemented a multi-paned display. In 2017, PC Gamer ranked EGATrek among the best Star Trek games.
Multiple commercial versions of the game were released in addition to the free ports. Apple Inc. released a version for the Apple II+ called Apple Trek in 1979, and Atari, Inc. released a version for the Atari 2600 as Stellar Track in 1980. The TRS-80 had at least three separate commercially available Star Trek games, including Trek-80 by Processor Technology (later retitled Invasion Force) which added more interactivity and a number of new options incorporated from the unrelated Trek73, a second Trek-80 by Judges Guild, and Startrek 3.5 from Adventure International. Acornsoft released a version titled Galaxy for their computer systems, and Tandy Computers released Space Trek for theirs. Yet another version was written in BASICA for the IBM Personal Computer in 1982, Video Trek 88; written by Windmill Software, it used numbers for most commands, like the earlier BYTE version. Apex Software released TI-Trek for the TI-99/4A in 1983, which incorporates speech if the speech synthesizer is present. 1984's Star Fleet I: The War Begins by Interstel was a variant released commercially for several computer systems. This game was successful enough to spawn a series.
Numerous hobby projects have continued to port the original game versions and enhanced variants to other languages and systems through to today. Additionally, some commercial games have been inspired by Star Trek, such as Star Raiders (1980), which was initially designed as a real time, 3D version of the game. As late as 1994, the collective Star Trek variants were still popular enough that Computer Gaming World claimed that the otherwise unrelated Stellar Explorer's gameplay was directly based on it, and that "anyone who remembers the old Trek games[...] will know exactly what this game is all about".