sample output


In Voyage to Neptune, you are in command of the first manned spaceship journeying from Earth to Neptune. The year is 2100, and manned space stations have been established at roughly 500-million-mile intervals along your route. These stations are at Jupiter (orbiting Callisto), Saturn (orbiting Titan), Uranus (on Ariel), and at several points midway between Saturn and Uranus, and Uranus and Neptune.

Navigation of your spacecraft is highly computerized, and you have a competent personnel officer on board to handle the inevitable people problems that will arise during a six-year journey. Your primary function as captain, therefore, is to maintain the delicate balance that will provide your ship with enough energy to reach its destination and return to Earth.

The following hints will help to speed you on your way:

If all goes well and you make judicious use of your resources, you can reach Neptune in just under six years with plenty of fuel left for your return voyage. Can you do it the first time or will you need a few trial runs?

sample output


Although fictional accounts of space voyages date back to the 1500s, the first serious rocket motor for space flight was not devised until the twentieth century. In 1903, K.E. Tsiolkovsky, a Russian pioneer of astronautics, proposed using a liquid-propelled rocket motor for space flight. The first rocket to employ an engine of this type was fired by Robert H. Goddard in the United States in 1926.

In Germany during World War II, Werner von Braun developed the V2 weapon, the first long-range liquid-fuel rocket. After the war, von Braun and most of the other German rocket specialists went to the United States, where they were instrumental in the development of rockets for satellite launches and space exploration.

Russia was also working on rockets and space vehicles and, on October 4, 1957, launched Sputnik I, the event that marked the real beginning of the space age. Other Soviet satellites followed and in 1958 the United States launched its first satellite, Explorer I, which provided the first information about the Van Allen radiation belts that surround the Earth.

In January 1959, the Soviet satellite Luna I was the first successful lunar probe, bypassing the moon at 3728 miles. A year later another Soviet satellite was the first to circle the moon. On April 12, 1961, the USSR launched the first manned spacecraft, Vostok I, with Yuri Gagarin aboard. The flight made one complete circuit of the Earth at a height ranging from 112 to 187 miles, and lasted one hour and 29 minutes. Three weeks later on May 5, Alan Shepard became the first American space traveler, making a short 15-minute suborbital "hop" in a Mercury vehicle.

In the 1960s, the U.S. undertook a major program to put a man on the moon. Milestones in this project included docking maneuvers between Gemini spacecraft in December 1965; the first manned flight around the moon by Frank Borman, James Lovell, and William Anders in December 1968; and finally, the lunar landing by Neil Armstrong and Edwin Aldrin on July 20, 1969.

Space stations have had a somewhat controversial history since they were first proposed by Tsiolkovsky in the 1920s. Stations are felt by some to be the most efficient method of launching deep space probes, because the probe vehicle will not have to overcome the force of Earth's gravity. Others feel that the cost of space stations cannot be justified in view of the marginal benefits.

Skylab, the first and only American space station, was launched on May 14, 1973 and was manned by three successive crews for a period of 171 days. The Soviets have made a greater commitment to space stations and have launched several different types, which they have manned for periods exceeding one year.

The spectacular success of the Voyager 1 and 2 probes to Jupiter, Saturn, Uranus, and Neptune indicates that the technology required to send spacecraft to the outer planets is in place.

However, for manned planetary exploration, particularly beyond Mars, it seems that some system of manned or unmanned way stations will be necessary.

The route to outer planets

This computer program, Voyage to Neptune, leaps ahead to a time when a series of manned space stations have been established on the route to the outer planets. We are assuming stations at roughly equal intervals of 400 to 500 million miles. They are at Jupiter (orbiting Callisto, the largest Jovian moon), Saturn (orbiting Titan, a moon larger than Mercury), Alpha 1 (midway between Saturn and Uranus). Uranus (on Ariel, the innermost moon), and Theta 2 (507 million miles beyond Uranus).

The voyage itself is all fiction. Your spaceship has engines which can operate using both solar energy (captured by giant parabolic collecting arrays) and nuclear fuel. Because solar radiation diminishes as you get further from the sun and you will not be able to carry enough nuclear fuel for the entire trip, you also have a multi-celled nuclear breeder reactor which takes the spent fuel from the propulsion engines along with a small amount of primary fuel and turns it all back into primary fuel.

The space stations along the way usually have a small stock of engine-repair parts (you also carry spare parts), breeder-reactor cells, and nuclear fuel, which are available to you on a barter basis.

Your objective in the game is to make the 2700-million-mile trip to Neptune in six years or less. It is possible but far from easy. Bon voyage.


The Voyage to Neptune program consists of five main program segments, initialization and summarization segments, and six short subroutines. At 169 lines, it is a relatively short program; nevertheless, the game is challenging and entertaining.

In the initialization section (Lines 100–160), the title is displayed and variables are initialized. A seed for the random-number generator is produced in Line 1570 and reduced, if necessary, to a valid value in Line 140.

The trip-segment counter (Line 190) loops through the trip segments until the seventh destination is reached, at which time program execution branches to the End Trip segment at Line 940.

The current-conditions section (Lines 220–360) prints the current location, condition of the ship, fuel supply, and performance during the last trip segment.

The trading section (Lines 380–550) allows you to trade nuclear fuel for breeder reactor cells and vice versa. Checks are made to make sure you are not trading more than you have or that you don't trade so many cells that your breeder reactor becomes inoperative.

The engine-power section (Lines 570–620) calculates the amount of power you receive from your solar collectors. Initially solar power meets 48% of your requirements, but that power decreases by 8% during each leg of the trip. You enter the amount of nuclear fuel you want to burn, and the program checks to be sure it is not more than you have.

In the breeder-reactor usage section (Lines 640–730), you enter the number of breeder-reactor cells you wish to operate. As the breeder cells need both primary nuclear fuel (5 pounds for each cell) and spent fuel from the engines (20 pounds for each cell), these conditions must be met.

The calculations section (Lines 750–840) is the heart of the program. Efficiency of the main engines is calculated in Line 760; it is the sum of the energy from the solar collectors plus the nuclear fuel. Maximum engine output is 104%. Rate of speed in mph and total distance in millions of miles are calculated in Line 780, while Line 790 utilizes speed and distance to calculate the time (in days) of this leg of the trip.

The amount of fuel produced by the breeder-reactor cells is calculated in Line 810; not being highly efficient, they produce from 16 to 33 pounds of fuel per cell.

This new fuel is added to the total fuel. There is a 20% chance that some of the fuel in storage will decay to an unusable state; this amount, if any, is calculated in Lines 820 and 830.

There is a 10% chance of an engine malfunction (Line 770); if it occurs, you are told about the problem, and the reduced efficiency of the engines is calculated (Lines 860–920).

The end-of-trip segment (Lines 940–1160) calculates the total time it took to reach Neptune, number of operational breeder-reactor cells, and remaining amount of fuel. Appropriate messages are printed about each factor, after which you are given a chance to play again or quit.

The subroutines to print the scenario (Lines 1180–1390); read location names and distances (Lines 1410–1440); calculate and print time in years, months, and days (Lines 1460–1530); temporarily break program execution (Lines 1550–1570); and print centered lines (Lines 1680–1690) do exactly what their names describe in a straightforward way.

The subroutine to extract the first letter of an input string (Lines 1630–1660) does just that using the familiar LEFT$ function. However, if the letter extracted is not uppercase (between A and Z), the function in Line 1660 converts the string to a numeric ASCII value, subtracts 32 (lowercase letters have ASCII values 32 higher than their corresponding uppercase letters), and converts the resulting value back to a string. While three distinct functions are performed, they can be accomplished with a single statement:

A$ = CHR$(ASC(A$) - 32)

There are several ways to make the game easier or more difficult. You can increase or decrease the propulsion efficiency of the nuclear fuel in Line 760. Dividing FUSEG by a value smaller than 40 will increase efficiency, while dividing by a value larger than 40 will decrease efficiency. In the same line, you can allow for engine speeds over 104% of normal if you wish. You can also improve the efficiency of the reactor by increasing either of the constants (16 or 18) in the first equation in Line 810:

FUBR = INT(16 + 18 * RND(1))

You can also change the barter price of fuel and breeder cells in Line 390, although doing so is a two-edged sword because sometimes you want to buy and other times to sell; best to leave it alone.


A	  Answer to input query, value
A$	  Answer to input query, string
BREED	  Total breeder - reactor cells on ship
DIS(n)	  Distance between segments (n = 1 to 7)
DIST	  Cumulative distance traveled (million miles)
DY	  Days
EF	  Engine-efficiency malfunction value
EFF	  Engine efficiency
FD	  Fuel-decay indicator
FUBR	  Fuel produced by each breeder cell
FUDCY	  Fuel that decayed in storage
FUSEG	  Fuel used on trip segment
FUTOT	  Fuel, total available
MO	  Months
RATE	  Rate of speed (mph)
RN	  Seed for random-number generator
PLAN$(n)  Planet or satellite name (n = 1 to 7)
SEG	  Trip-segment counter
TIME	  Time of trip segment (days)
TM	  Time, temporary
TOTIME	  Cumulative total time of trip
UBREED	  Breeder-reactor cells in use
X$	  Temporary string
YR	  Years


Download NEPTUNE.BAS (tokenized BASIC format)

110 LOCATE 10, 1 : X$ = "Voyage to Neptune, 2100" : GOSUB 1680
120 LOCATE 13, 1 : X$ = "(c) by David H. Ahl, 1986" : GOSUB 1680
130 LOCATE 23, 1 : GOSUB 1550
140 WHILE RN > 32767 : RN = RN - 65535! : WEND : RANDOMIZE RN : CLS
150 GOSUB 1180 : 'Display initial scenario
160 BREED = 120 : FUTOT = 3000 : GOSUB 1420 : 'Set initial values
170 '
180 'Loop through trip segments
190 SEG = SEG + 1 : 'Trip segment counter
200 IF SEG = 7 THEN 940 : 'Reach Neptune?
210 '
220 'Print current conditions
230 PRINT : PRINT "Current conditions are as follows:"
240 PRINT " Location :" PLAN$(SEG)
250 PRINT " Distance to Neptune:" 2701-DIST "million miles."
260 IF SEG = 1 THEN 350 : 'First trip segment?
270 PRINT " Distance from Earth:" DIST "million miles."
280 PRINT "Over the last segment, your average speed was" INT(RATE) "mph,"
290 PRINT " and you covered" DIS(SEG - 1) "million miles in" TIME "days."
300 TM = .81 * DIST : PRINT "Time est for this total distance:"; : GOSUB 1460
310 TM = TOTIME : PRINT "Your actual cumulative time was:"; : GOSUB 1460
320 PRINT "You used" UBREED "cells which produced" FUBR "pounds of fuel each."
330 IF FUDCY = 0 THEN 350
340 PRINT FUDCY "pounds of fuel in storage decayed into an unusable state."
350 PRINT "Pounds of of nuclear fuel ready for use:" FUTOT
360 PRINT "Operational breeder-reactor cells:" BREED : PRINT
370 '
380 'Trade fuel for breeder-reactor cells
390 TRADE = INT(150 + 80 * RND(1)) : IF SEG > 1 THEN 420
400 PRINT "Before leaving, you can trade fuel for breeder-reactor cells at"
410 GOTO 430
420 PRINT "Here at " PLAN$(SEG) ", breeder cells and nuclear-fuel trade at"
430 PRINT "the rate of" TRADE "pounds of fuel per cell." : PRINT
440 IF FUTOT - TRADE < 1501 THEN PRINT "You have too little fuel to trade." : GOTO 500
450 INPUT " Would you like to procure more breeder cells (Y or N)";A$ : GOSUB 1590
460 IF A$< >"Y" THEN 500
470 INPUT "How many cells do you want";A
480 F = FUTOT - A * TRADE : IF F > 1500 THEN FUTOT = F : BREED = BREED + A : GOTO 570
490 PRINT "That doesn't leave enough fuel to run the engines." : GOTO 470
500 INPUT "Would you like to trade some breeder cells for fuel";A$ : GOSUB 1590
510 IF A$< >"Y" THEN 570
520 INPUT "How many cells would you like to trade";A
530 F = BREED - A : IF F > 49 THEN BREED = F : FUTOT = FUTOT + A * TRADE : GOTO 570
540 PRINT "That would leave only" F "cells. The reactor requires a minimum"

550 PRINT "of 50 cells to remain operational." : GOTO 520
560 '
570 'Engine power
580 PRINT "At this distance from the sun, your solar collectors can fulfill"
590 PRINT 56 - SEG * 8 "% of the fuel requirements of the engines. How many pounds"
600 INPUT "of nuclear fuel do you want to use on this segment";FUSEG
610 IF FUSEG <= FUTOT THEN FUTOT = FUTOT - FUSEG : GOTO 650 : 'Enough fuel?
620 PRINT "That's more fuel than you have. Now then, how many pounds" : GOTO 600
630 '
640 'Breeder reactor usage
650 INPUT "How many breeder-reactor cells do you want to operate";UBREED
660 IF UBREED > BREED THEN PRINT "You don't have that many cells." : GOTO 650
670 IF FUSEG / 20 >= UBREED THEN 700 : 'Enough spent fuel from engines?
680 PRINT "The spent fuel from your engines is only enough to operate" FUSEG / 20
690 PRINT " breeder reactor cells. Again please…" : GOTO 650
700 IF UBREED * 5 <= FUTOT THEN 730 : 'Enough new seed fuel?
710 PRINT "You have only enough fuel to seed" INT(FUTOT / 5) "breeder cells."
720 PRINT "Please adjust your number accordingly." : GOTO 650
740 '
750 'Calculate the results of input data
760 EFF = 56 - SEG * 8 + FUSEG / 40 : IF EFF > 104 THEN EFF = 104 : 'Efficiency = 104% max
770 EF = RND(1) : IF EF < .1 THEN GOSUB 860 : '10% chance of engine problem
780 RATE = EFF * 513.89 : DIST = DIST + DIS(SEG) : 'Rate in mph, dist in million miles
790 TIME = INT(DIS(SEG) * 41667! / RATE) : 'Time in days
800 TOTIME = TOTIME + TIME : 'Total trip time
810 FUBR = INT(16 + 18 * RND(1)) : FUTOT = FUTOT + FUBR * UBREED : 'New fuel from breeder
820 FD = RND(1) : IF FD < .2 THEN FUDCY = INT(FD * FUTOT) : 'How much fuel decayed?
830 FUTOT = FUTOT - FUDCY : 'Decrease fuel by amount that decayed
840 GOTO 190
850 '
860 'Subroutine for engine problem
870 CLS : FOR J = 1 TO 7
890 FOR I = 1 TO 80 : NEXT I : CLS : FOR I = 1 TO 50 : NEXT I : NEXT J
900 PRINT "You will have to operate your engines at a" INT(300 * EF)"% reduction"
910 PRINT "in speed until you reach " PLAN$(SEG + 1) "." : PRINT
920 EFF = EFF * (1 - 3 * EF) : RETURN
930 '
940 'End of trip segment
950 PRINT : PRINT "You finally reached Neptune in"; : TM = TOTIME : GOSUB 1460
960 PRINT "Had your engines run at 100% efficiency the entire way, you would"
970 PRINT "have averaged 51, 389 mph and completed the trip in exactly 6 years."
980 IF TM > 2220 THEN 1000
990 PRINT : X$ = "Congratulations! Outstanding job!" : GOSUB 1680 : PRINT : GOTO 1070

1000 TM = TOTIME - 2190 : PRINT : PRINT "Your trip took longer than this by";
1010 GOSUB 1460 : PRINT "Your performance was"; : YR = YR + 1 : IF YR > 4 THEN YR = 4
1020 ON YR GOTO 1030, 1040, 1050, 1060
1030 PRINT "excellent (room for slight improvement)." : GOTO 1070
1040 PRINT "quite good (but could be better)." : GOTO 1070
1050 PRINT "marginal (could do much better)." : GOTO 1070
1060 PRINT "abysmal (need lots more practice)."
1070 PRINT : IF BREED < 105 THEN 1100
1080 PRINT "Fortunately you have" BREED "operational breeder-reactor cells"
1090 PRINT "for your return trip. Very good." : GOTO 1120
1100 PRINT "I guess you realize that the return trip will be extremely"
1110 PRINT "chancy with only" BREED "breeder-reactor cells operational."
1120 PRINT "With your remaining" FUTOT "pounds of fuel and" BREED "breeder"
1130 TM = 42250! / (8 + FUTOT / 40) : IF TM < 405 THEN TM = 405
1140 PRINT "cells, to get back to Theta 2 will take"; : GOSUB 1460
1150 PRINT : INPUT "Would you like to try again (Y or N)";A$
1160 GOSUB 1590 : IF A$ = "Y" THEN RUN ELSE CLS : KEY ON : PRINT "Bye!" : END
1170 '
1180 'Subroutine to print the scenario
1190 CLS : X$ = "Voyage to Neptune" : GOSUB 1680 : PRINT : PRINT
1200 PRINT " It is the Year 2100 and you are in command of the first manned"
1210 PRINT "spaceship to Neptune. Manned space stations have been established"
1220 PRINT "which orbit Callisto, Titan, and Ariel, as well as at two inter-"
1230 PRINT "mediate points between Saturn and Uranus, and Uranus and Neptune."
1240 PRINT "You must travel about 2700 million miles. At an average speed of"
1250 PRINT "over 50, 000 miles per hour, the entire trip should take about"
1260 PRINT "six years."
1270 PRINT " Your spaceship is a marvel of 21st century engineering. Since"
1280 PRINT "you may have to stop at space stations along the way, you will not"
1290 PRINT "be able to use the gravitational 'slingshot' effect of the planets."
1300 PRINT "However, your engines are highly efficient using both energy from"
1310 PRINT "the sun captured by giant parabolic arrays and nuclear fuel carried"
1320 PRINT "on board. You will not be able to carry enough fuel for the whole"
1330 PRINT "trip, so you also have a multi-celled nuclear breeder reactor"
1340 PRINT "(which takes spent fuel from your engines along with a small amount"
1350 PRINT "of primary fuel and turns it into a much greater amount of primary"
1360 PRINT "fuel)."
1370 PRINT " The space stations along the way usually have a small stock of"
1380 PRINT "engine repair parts, breeder-reactor cells, and nuclear fuel which"
1390 PRINT "are available to you on a barter basis." : GOSUB 1550 : RETURN
1400 '
1410 'Subroutine to read location names and distances
1420 FOR I = 1 TO 7 : READ PLAN$(I), DIS(I) : NEXT I : RETURN
1430 DATA "Earth", 391, "Callisto", 403, "Titan", 446, "Alpha 1", 447
1440 DATA "Ariel", 507, "Theta 2", 507, "Neptune", 0

1450 '
1460 'Subroutine to calculate and print time in years
1470 YR = INT(TM / 365) : IF YR < 1 THEN 1490
1480 IF YR = 1 THEN PRINT " 1 year"; ELSE PRINT YR "years";
1490 MO = INT((TM / 365 - YR) * 12) : IF MO < 1 THEN 1510
1500 IF MO = 1 THEN PRINT ", 1 month"; ELSE PRINT "," MO "months";
1510 DY = INT(TM - YR * 365 - MO * 30.5) : IF DY < 1 THEN PRINT "." : RETURN
1520 IF DY = 1 THEN PRINT ", 1 day." ELSE PRINT "," DY "days."
1540 '
1550 'Subroutine to temporarily break execution
1560 PRINT : X$ = "Press any key to continue." : GOSUB 1680
1580 '
1590 'Subroutine to read yes/no answer
1600 GOSUB 1630 : IF A$ = "Y" OR A$ = "N" THEN RETURN
1610 INPUT "Don't understand your answer. Enter 'Y' or 'N' please";A$ : GOTO 1600
1620 '
1630 'Subroutine to extract the first letter of an input answer (in upper case)
1640 IF A$ = "" THEN A$ = "Y" : RETURN
1650 A$ = LEFT$(A$, 1) : IF A$ >= "A" AND A$ <= "Z" THEN RETURN
1660 A$ = CHR$(ASC(A$) - 32) : RETURN
1670 '
1680 'Subroutine to print centered lines
1690 PRINT TAB((70 - LEN(X$)) / 2) X$; : RETURN

Return to Table of Contents | Previous Section | Next Section