zd : n  , : X$"Space Voyage to Neptune, 2100" : x  , : X$"(c) by David H. Ahl, 1986" :  , : $ RN : RNRN : : RN : L  : :Display initial scenarioBREEDx : FUTOT :  : :Set initial values::Loop through trip segmentsSEGSEG : :Trip segment counter SEG  : :Reach Neptune?:%:Print current conditionsT : "Current conditions are as follows:"u " Location: " PLAN$(SEG) " Distance to Neptune:"  DIST "million miles." SEG ^ : :First trip segment? " Distance from Earth:" DIST "million miles."V "Over the last segment, your average speed was" (RATE) "mph,"" " and you covered" DIS(SEG) "million miles in" TIME "days.",TM)\ODIST : "Time est for this total distance:"; : 6TMTOTIME : "Your actual cumulative time was:"; : h@ "You used" UBREED "cells which produced" FUBR "pounds of fuel each."|J FUDCY ^T FUDCY "pounds of fuel in storage decayed into an unusable state."^ "Pounds of of nuclear fuel ready for use:" FUTOT0h "Operational breeder reactor cells:" BREED : 8r:d|:Trade fuel for breeder reactor cellsTRADE(P()) : SEG  "Before leaving, you can trade fuel for breeder reactor cells at" ( "Here at " PLAN$(SEG) ", breeder cells and nuclear fuel trade at"a "the rate of" TRADE "pounds of fuel per cell." :  FUTOTTRADE "You have too little fuel to trade.":  "Would you like to procure more breeder cells (Y or N)";A$: 6 A$"Y" ' "How many cells do you want";AgFFUTOTATRADE : F FUTOTF : BREEDBREEDA : : "That doesn't leave enough fuel to run the engines." :  "Would you like to trade some breeder cells for fuel";A$ : 6 A$"Y" :6 "How many cells would you like to trade";AuFBREEDA : F1 BREEDF : FUTOTFUTOTATRADE : : "That would leave only" F "cells. The reactor requires a minimum"& "of 50 cells to remain operational." : 0: ::Engine powerVD "At this distance from the sun, your solar collectors can fulfill"N 8SEG "% of the fuel requirements of the engines. How many pounds"X "of nuclear fuel do you want to use on this segment";FUSEG%b FUSEGFUTOT FUTOTFUTOTFUSEG :  : :Enough fuel?ol "That's more fuel than you have. Now then, how many pounds" : Xwv::Breeder reactor usage "How many breeder reactor cells do you want to operate";UBREED UBREEDBREED "You don't have that many cells." : \ FUSEGUBREED  : :Enough spent fuel from engines? "The spent fuel from your engines is only enough to operate" FUSEG " breeder reactor cells. Again please..." :  UBREEDFUTOT  : :Enough new seed fuel?a "You have only enough fuel to seed" (FUTOT) "breeder cells." "Please adjust your number accordingly." : FUTOTFUTOTUBREED::Calculate the results of input data-EFF8SEGFUSEG( : EFFh EFFh : :Efficiency = 104% maxqEF() : EFL} \ : :10% chance of engine problem RATEEFFx : DISTDISTDIS(SEG) : :Rate in mph, dist in million milesTIME(DIS(SEG)"RATE) : :Time in days TOTIMETOTIMETIME : :Total trip timen *FUBR(()) : FUTOTFUTOTFUBRUBREED : :New fuel from breeder 4FD() : FDL~ FUDCY(FDFUTOT) : :How much fuel decayed? >FUTOTFUTOTFUDCY : :Decrease fuel by amount that decayed!H  !R:0!\:Subroutine for engine problemB!f : J y!p : : X$"ENGINE MALFUNCTION !" :  , : !z I P : I : : I 2 : I : J! "You will have to operate your engines at a" (,EF)"% reduction"-" "in speed until you reach " PLAN$(SEG) "." : F"EFFEFF(EF) : N":i":End of trip segment" : "You finally reached Neptune in"; : TMTOTIME : " "Had your engines run at 100% efficiency the entire way, you would"?# "have averaged 51,389 mph and completed the trip in exactly 6 years."R# TM #: X$"Congratulations! Outstanding job!": : : .#TMTOTIME : : "Your trip took longer than this by";$  : "Your performance was "; : YRYR : YR YR.$ YR ,,,$g$ "excellent (room for slight improvement)." : .$ "quite good (but could be better)." : .$ "marginal (could do much better)." : .$$ "abysmal (need lots more practice)."%. : BREEDi LU%8 "Fortunately you have" BREED "operational breeder reactor cells"%B "for your return trip. Very good." : `%L "I guess you realize that the return trip will be extremely"&V "chancy with only" BREED "breeder reactor cells operational."U&` "With your remaining" FUTOT "pounds of fuel and" BREED "breeder"&jTM %(FUTOT() : TM TM&t "cells, to get back to Theta 2 will take"; : &~ : "Would you like to try again (Y or N)";A$' 6 : A$"Y" : "M" : ':F':Subroutine to print the scenario{' : X$"Space Voyage to Neptune" :  : : ' " It is the Year 2100 and you are in command of the first manned"( "spaceship to Neptune. Manned space stations have been established"[( "which orbit Callisto, Titan, and Ariel, as well as at two inter-"( "mediate points between Saturn and Uranus, and Uranus and Neptune."( "You must travel about 2700 million miles. At an average speed of"5) "over 50,000 miles per hour, the entire trip should take about"H) "six years.") " Your spaceship is a marvel of 21st century engineering. Since") "you may have to stop at space stations along the way, you will not"+*  "be able to use the gravitational 'slingshot' effect of the planets."u* "However, your engines are highly efficient using both energy from"* "the sun captured by giant parabolic arrays and nuclear fuel carried" +( "on board. You will not be able to carry enough fuel for the whole"R+2 "trip, so you also have a multi-celled nuclear breeder reactor"+< "(which takes spent fuel from your engines along with a small amount"+F "of primary fuel and turns it into a much greater amount of primary"+P "fuel)."D,Z " The space stations along the way usually have a small stock of",d "engine repair parts, breeder reactor cells, and nuclear fuel which",n "are available to you on a barter basis." :  : ,x: -:Subroutine to read location names and distances6- I  : PLAN$(I),DIS(I) : I : q- "Earth",391,"Callisto",403,"Titan",446,"Alpha 1",447- "Ariel",507,"Theta 2",507,"Neptune",0-:-:Subroutine to calculate and print time in years-YR(TMm) : YR (. YR " 1 year"; : YR "years";Q.MO((TMmYR) ) : MO . MO ", 1 month"; : "," MO "months";.DY(TMYRmMOt) : DY "." : . DY ", 1 day." : "," DY "days."..:#/:Subroutine to temporarily break executionS/ : X$"Press any key to continue." : {/" () : RNRN : : : : /,:/6:Subroutine to read yes/no answer/@ ^ : A$"Y" A$"N" 0J "Don't understand your answer. Enter 'Y' or 'N' please";A$: @0T:n0^:Subroutine to extract the first letter of an input answer (in upper case)0h A$"" A$"Y" : 0rA$(A$,) : A$"A" A$"Z" 0|A$((A$) ) : 0:0:Subroutine to print centered lines1 (F(X$))) X$ ;: