Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Star Trek 1971 Text Game

, 29 Jul 2008 LGPL3
A reworking of the 1971 Star Trek text game using C#
StarTrek2008.07.27.zip
StarTrek
basic
StarTrek
Properties
StarTrek.csproj.user
SuperStarTrek
Properties
10  REM ****  HP BASIC PROGRAM LIBRARY  ******************************
20  REM
30  REM       STTR1: STAR TREK
40  REM
50  REM       36243  REV B  --  10/73
60  REM
70  REM ****  CONTRIBUTED PROGRAM  ***********************************
71  REM Shortened to <=72 char lines 3/08
72  REM Converted to paper-tape basic by Terry Newton 9/07
73  REM Strings, PRINT USING and other syntax matters re-coded
74  REM Variable names changed to single letters and arrays...
75  REM A - A$ replacement and general temp use
76  REM C - C$ replacement (status)
77  REM T E P S I J X Y N H left as is
78  REM T0,T9-->T[1],T[2] T7 removed
79  REM D0-->D  E0-->K  P0-->M  H8-->Q  R1-->F
80  REM R2-->G  W1-->W  C1-->B  C2-->R
81  REM S1,S2,S3,S9-->S[1],S[2],S[3],S[4]
82  REM Q1,Q2-->Q[1],Q[2]
83  REM B3,B9-->B[1],B[2]
84  REM K3,K7,K9-->P[1],P[2],P[3]
85  REM X1,X2-->X[1],X[2]
86  REM Z1,Z2 and my Z7,Z8,Z9-->V[1],V[2],V[3],V[4],V[5]
87  REM Z3 and original string subs removed or heavily modified.
88  REM V[6] used to flag calculator use, added WARP UNITS to calc.
89  REM Z and L added for number print subs
90  REM PRINT USING/IMAGE conversions mostly from 9/06 TSBE conversion
91  REM An interesting bug arose.. directions were wrong.. then looked
92  REM at the tsb-e conversion and noticed coords spec'd y,x.. forgot
93  REM about that and had assumed x,y coords so altered the numbers in
94  REM the C[,] array to compensate. This led to several other changes
95  REM to various display subroutines and docs.. almost wish I hadn't
96  REM done that but I like it better this way (just how it came out).
97  REM Added subs for number printing to display mostly original text.
98  REM Note.. L.R.scan and galaxy map formatted for paper-tape basic.
99  REM LAST MOD 9/23/07
100  REM **************************************************************
110  REM ***
120  REM ***     STAR TREK: BY MIKE MAYFIELD, CENTERLINE ENGINEERING
130  REM ***
140  REM ***        TOTAL INTERACTION GAME - ORIG. 20 OCT 1972
150  REM ***
160  REM **************************************************************
170  FOR I=1 TO 20
172  PRINT
174  NEXT I
180  PRINT "                          STAR TREK "
182  PRINT
183  PRINT
184  PRINT
190  PRINT "ENTER 1 OR 2 FOR INSTRUCTIONS (ENTER 2 TO PAGE) ";
200  INPUT A
205  IF A#1 AND A#2 THEN 210
207  GOSUB 5820
208  REM randomize query to mix it up, not in original
210  PRINT
211  PRINT "ENTER SEED NUMBER ";
212  INPUT A
213  LET A=INT(ABS(A))
215  PRINT "INITIALIZING..."
220  FOR I=0 TO A
222  LET J=RND(1)
225  NEXT I
230  REM *****  PROGRAM STARTS HERE *****
240  PRINT
260  DIM G[8,8],C[9,2],K[3,3],N[3],Z[8,8]
270  DIM A[8,8],D[9],T[2],S[4],Q[2],B[2],P[3],X[2],V[6]
290  LET T=INT(RND(1)*20+20)*100
291  LET T[1]=T
300  LET T[2]=30
310  LET D=0
320  LET E=3000
321  LET K=E
330  LET P=10
331  LET M=P
340  LET S[4]=200
350  LET Q=0
351  LET S=0
360  DEF FND(D)=SQR((K[I,1]-S[1])^2+(K[I,2]-S[2])^2)
370  LET Q[1]=INT(RND(1)*8+1)
380  LET Q[2]=INT(RND(1)*8+1)
390  LET S[1]=INT(RND(1)*8+1)
400  LET S[2]=INT(RND(1)*8+1)
410  REM C array numbers changed for X,Y notation/display
420  REM dir 1 = X+1,Y    right
421  LET C[1,1]=1
422  LET C[1,2]=0
423  REM dir 2 = X+1,Y-1  right and up
424  LET C[2,1]=1
425  LET C[2,2]=-1
426  REM dir 3 = X, Y-1   up
427  LET C[3,1]=0
428  LET C[3,2]=-1
429  REM dir 4 = X-1,Y-1  left and up
430  LET C[4,1]=-1
431  LET C[4,2]=-1
432  REM dir 5 = X-1,Y    left
433  LET C[5,1]=-1
434  LET C[5,2]=0
435  REM dir 6 = X-1,Y+1  left and down
436  LET C[6,1]=-1
437  LET C[6,2]=1
438  REM dir 7 = X,Y+1    down
439  LET C[7,1]=0
440  LET C[7,2]=1
441  REM dir 8 = X+1,Y+1  right and down
442  LET C[8,1]=1
443  LET C[8,2]=1
444  REM dir 9 = same as dir 1
445  LET C[9,1]=1
446  LET C[9,2]=0
450  MAT D=ZER
490  LET B[2]=0
491  LET P[3]=0
500  FOR I=1 TO 8
510  FOR J=1 TO 8
520  LET F=RND(1)
530  IF F>.98 THEN 580
540  IF F>.95 THEN 610
550  IF F>.8 THEN 640
560  LET P[1]=0
570  GOTO 660
580  LET P[1]=3
590  LET P[3]=P[3]+3
600  GOTO 660
610  LET P[1]=2
620  LET P[3]=P[3]+2
630  GOTO 660
640  LET P[1]=1
650  LET P[3]=P[3]+1
660  LET F=RND(1)
670  IF F>.96 THEN 700
680  LET B[1]=0
690  GOTO 720
700  LET B[1]=1
710  LET B[2]=B[2]+1
720  LET S[3]=INT(RND(1)*8+1)
730  LET G[I,J]=P[1]*100+B[1]*10+S[3]
740  LET Z[I,J]=0
750  NEXT J
760  NEXT I
770  LET P[2]=P[3]
775  IF B[2] <= 0 OR P[3] <= 0 THEN 490
779  REM mod for number print sub and plurality
780  PRINT "YOU MUST DESTROY ";
781  LET Z=P[3]
782  GOSUB 9400
783  PRINT " KINGONS IN ";
784  LET Z=T[2]
785  GOSUB 9400
786  PRINT " STARDATES WITH ";
788  LET Z=B[2]
789  GOSUB 9400
790  PRINT " STARBASE";
791  IF B[2]=1 THEN 793
792  PRINT "S";
793  PRINT
800  PRINT
810  LET P[1]=0
811  LET B[1]=0
812  LET S[3]=0
820  IF Q[1]<1 OR Q[1]>8 OR Q[2]<1 OR Q[2]>8 THEN 920
830  LET X=G[Q[1],Q[2]]*1.00000E-02
840  LET P[1]=INT(X)
850  LET B[1]=INT((X-P[1])*10)
860  LET S[3]=G[Q[1],Q[2]]-INT(G[Q[1],Q[2]]*.1)*10
870  IF P[1]=0 THEN 910
880  IF S>200 THEN 910
890  PRINT "COMBAT AREA      CONDITION RED"
900  PRINT "   SHIELDS DANGEROUSLY LOW"
910  MAT K=ZER
920  FOR I=1 TO 3
930  LET K[I,3]=0
940  NEXT I
942  REM string arrays replaced with A[x,y]
943  REM 0="   "
944  REM 1="<*>"
945  REM 2="+++"
946  REM 3=">!<"
947  REM 4=" * "
950  MAT A=ZER
1000  LET A[INT(S[1]+.5),INT(S[2]+.5)]=1
1020  FOR I=1 TO P[1]
1030  GOSUB 5380
1040  LET A[F,G]=2
1080  LET K[I,1]=F
1090  LET K[I,2]=G
1100  LET K[I,3]=S[4]
1110  NEXT I
1120  FOR I=1 TO B[1]
1130  GOSUB 5380
1140  LET A[F,G]=3
1180  NEXT I
1190  FOR I=1 TO S[3]
1200  GOSUB 5380
1210  LET A[F,G]=4
1250  NEXT I
1260  GOSUB 4120
1270  PRINT "COMMAND ";
1280  INPUT A
1290  IF A=0 THEN 1410
1291  IF A=1 THEN 1260
1292  IF A=2 THEN 2330
1293  IF A=3 THEN 2530
1294  IF A=4 THEN 2800
1295  IF A=5 THEN 3460
1296  IF A=6 THEN 3560
1297  IF A=7 THEN 4630
1300  PRINT
1310  PRINT "   0 = SET COURSE"
1320  PRINT "   1 = SHORT RANGE SENSOR SCAN"
1330  PRINT "   2 = LONG RANGE SENSOR SCAN"
1340  PRINT "   3 = FIRE PHASERS"
1350  PRINT "   4 = FIRE PHOTON TORPEDOES"
1360  PRINT "   5 = SHIELD CONTROL"
1370  PRINT "   6 = DAMAGE CONTROL REPORT"
1380  PRINT "   7 = CALL ON LIBRARY COMPUTER"
1390  PRINT
1400  GOTO 1270
1410  PRINT "COURSE (1-9) ";
1420  INPUT B
1430  IF B=0 THEN 1270
1440  IF B<1 OR B >= 9 THEN 1410
1450  PRINT "WARP FACTOR (0-8) ";
1460  INPUT W
1470  IF W<0 OR W>8 THEN 1410
1480  IF D[1] >= 0 OR W <= .2 THEN 1510
1490  PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .2"
1500  GOTO 1410
1510  IF P[1] <= 0 THEN 1560
1520  GOSUB 3790
1530  IF P[1] <= 0 THEN 1560
1540  IF S<0 THEN 4000
1550  GOTO 1610
1560  IF E>0 THEN 1610
1570  IF S<1 THEN 3920
1579  REM mod for number print sub
1580  PRINT "YOU HAVE ";
1581  LET Z=E
1582  GOSUB 9400
1583  PRINT " UNITS OF ENERGY"
1590  PRINT "SUGGEST YOU GET SOME FROM YOUR SHIELDS WHICH HAVE"S
1592  PRINT "UNITS LEFT"
1600  GOTO 1270
1610  FOR I=1 TO 8
1620  IF D[I] >= 0 THEN 1640
1630  LET D[I]=D[I]+1
1640  NEXT I
1650  IF RND(1)>.2 THEN 1810
1660  LET F=INT(RND(1)*8+1)
1670  IF RND(1) >= .5 THEN 1750
1680  LET D[F]=D[F]-(RND(1)*5+1)
1690  PRINT
1700  PRINT "DAMAGE CONTROL REPORT: ";
1710  GOSUB 5610
1720  PRINT " DAMAGED"
1730  PRINT
1740  GOTO 1810
1750  LET D[F]=D[F]+(RND(1)*5+1)
1760  PRINT
1770  PRINT "DAMAGE CONTROL REPORT: ";
1780  GOSUB 5610
1790  PRINT " STATE OF REPAIR IMPROVED"
1800  PRINT
1810  LET N=INT(W*8)
1820  REM string "   " insertion removed
1830  LET A[INT(S[1]+.5),INT(S[2]+.5)]=0
1870  LET X=S[1]
1880  LET Y=S[2]
1885  LET R=INT(B)
1890  LET X[1]=C[R,1]+(C[R+1,1]-C[R,1])*(B-R)
1900  LET X[2]=C[R,2]+(C[R+1,2]-C[R,2])*(B-R)
1910  FOR I=1 TO N
1920  LET S[1]=S[1]+X[1]
1930  LET S[2]=S[2]+X[2]
1940  IF S[1]<.5 OR S[1] >= 8.5 OR S[2]<.5 OR S[2] >= 8.5 THEN 2170
1950  REM string "   " comparison removed
1960  IF A[INT(S[1]+.5),INT(S[2]+.5)]=0 THEN 2070
2030  REM print using removed
2031  PRINT "WARP ENGINES SHUTDOWN AT SECTOR";
2032  LET V[4]=S[1]
2033  LET V[5]=S[2]
2034  GOSUB 9000
2035  PRINT "DUE TO BAD NAVIGATION"
2040  LET S[1]=S[1]-X[1]
2050  LET S[2]=S[2]-X[2]
2060  GOTO 2080
2070  NEXT I
2080  REM string "<*>" insertion removed
2083  LET S[1]=INT(S[1]+.5)
2086  LET S[2]=INT(S[2]+.5)
2090  LET A[S[1],S[2]]=1
2120  LET E=E-N+5
2130  IF W<1 THEN 2150
2140  LET T=T+1
2150  IF T>T[1]+T[2] THEN 3970
2160  GOTO 1260
2170  LET X=Q[1]*8+X+X[1]*N
2180  LET Y=Q[2]*8+Y+X[2]*N
2190  LET Q[1]=INT(X/8)
2200  LET Q[2]=INT(Y/8)
2210  LET S[1]=INT(X-Q[1]*8+.5)
2220  LET S[2]=INT(Y-Q[2]*8+.5)
2230  IF S[1]#0 THEN 2260
2240  LET Q[1]=Q[1]-1
2250  LET S[1]=8
2260  IF S[2]#0 THEN 2290
2270  LET Q[2]=Q[2]-1
2280  LET S[2]=8
2290  LET T=T+1
2300  LET E=E-N+5
2310  IF T>T[1]+T[2] THEN 3970
2320  GOTO 810
2330  IF D[3] >= 0 THEN 2370
2340  PRINT "LONG RANGE SENSORS ARE INOPERABLE"
2360  GOTO 1270
2365  REM print using/image converted
2370  PRINT "LONG RANGE SENSOR SCAN FOR QUADRANT";
2371  LET V[4]=Q[1]
2372  LET V[5]=Q[2]
2373  GOSUB 9000
2374  PRINT
2375  REM converted to X,Y display
2380  PRINT "-------------------"
2390  FOR J=Q[2]-1 TO Q[2]+1
2400  MAT N=ZER
2410  FOR I=Q[1]-1 TO Q[1]+1
2420  IF I<1 OR I>8 OR J<1 OR J>8 THEN 2460
2430  LET N[I-Q[1]+2]=G[I,J]
2440  IF D[7]<0 THEN 2460
2450  LET Z[I,J]=G[I,J]
2460  NEXT I
2470  PRINT N[1]":"N[2]":"N[3]
2480  PRINT "-------------------"
2490  NEXT J
2500  GOTO 1270
2530  IF P[1] <= 0 THEN 3670
2540  IF D[4] >= 0 THEN 2570
2550  PRINT "PHASER CONTROL IS DISABLED"
2560  GOTO 1270
2570  IF D[7] >= 0 THEN 2590
2580  PRINT " COMPUTER FAILURE HAMPERS ACCURACY"
2590  PRINT "PHASERS LOCKED ON TARGET.  ENERGY AVAILABLE ="E
2600  PRINT "NUMBER OF UNITS TO FIRE ";
2610  INPUT X
2620  IF X <= 0 THEN 1270
2630  IF E-X<0 THEN 2570
2640  LET E=E-X
2650  GOSUB 3790
2660  IF D[7] >= 0 THEN 2680
2670  LET X=X*RND(1)
2680  FOR I=1 TO 3
2690  IF K[I,3] <= 0 THEN 2770
2700  LET H=(X/P[1]/FND(0))*(2*RND(1))
2710  LET K[I,3]=K[I,3]-H
2718  REM print using/image converted
2720  LET Z=H
2721  GOSUB 9400
2722  PRINT " UNIT HIT ON KLINGON AT SECTOR";
2723  LET V[4]=K[I,1]
2724  LET V[5]=K[I,2]
2725  GOSUB 9000
2726  PRINT TAB(41);"(";
2727  LET Z=K[I,3]
2728  GOSUB 9400
2729  PRINT " LEFT)"
2740  IF K[I,3]>0 THEN 2770
2750  GOSUB 3690
2760  IF P[3] <= 0 THEN 4040
2770  NEXT I
2780  IF E<0 THEN 4000
2790  GOTO 1270
2800  IF D[5] >= 0 THEN 2830
2810  PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
2820  GOTO 1270
2830  IF P>0 THEN 2860
2840  PRINT "ALL PHOTON TORPEDOES EXPENDED"
2850  GOTO 1270
2860  PRINT "TORPEDO COURSE (1-9) ";
2870  INPUT B
2880  IF B=0 THEN 1270
2890  IF B<1 OR B >= 9 THEN 2860
2895  LET R=INT(B)
2900  LET X[1]=C[R,1]+(C[R+1,1]-C[R,1])*(B-R)
2910  LET X[2]=C[R,2]+(C[R+1,2]-C[R,2])*(B-R)
2920  LET X=S[1]
2930  LET Y=S[2]
2940  LET P=P-1
2950  PRINT "TORPEDO TRACK:"
2960  LET X=X+X[1]
2970  LET Y=Y+X[2]
2980  IF X<.5 OR X >= 8.5 OR Y<.5 OR Y >= 8.5 THEN 3420
2988  REM print using/image converted
2990  LET V[4]=X
2991  LET V[5]=Y
2992  GOSUB 9000
2993  PRINT
3010  REM string "   " comparison removed
3020  IF A[INT(X+.5),INT(Y+.5)]#0 THEN 3070
3060  GOTO 2960
3070  REM string "+++" comparison removed
3080  IF A[INT(X+.5),INT(Y+.5)]#2 THEN 3220
3120  PRINT "*** KLINGON DESTROYED ***"
3130  LET P[1]=P[1]-1
3140  LET P[3]=P[3]-1
3150  IF P[3] <= 0 THEN 4040
3160  FOR I=1 TO 3
3170  IF INT(X+.5)#K[I,1] THEN 3190
3180  IF INT(Y+.5)=K[I,2] THEN 3200
3190  NEXT I
3200  LET K[I,3]=0
3210  GOTO 3360
3220  REM string " * " comparison removed
3230  IF A[INT(X+.5),INT(Y+.5)]#4 THEN 3290
3270  PRINT "YOU CAN'T DESTROY STARS SILLY"
3280  GOTO 3420
3288  REM string ">!<" comparison removed
3290  IF A[INT(X+.5),INT(Y+.5)]#3 THEN 2960
3340  PRINT "*** STAR BASE DESTROYED ***  .......CONGRATULATIONS"
3350  LET B[1]=B[1]-1
3360  REM string "   " insertion removed
3370  LET V[1]=INT(X+.5)
3380  LET V[2]=INT(Y+.5)
3390  LET A[V[1],V[2]]=0
3400  LET G[Q[1],Q[2]]=P[1]*100+B[1]*10+S[3]
3410  GOTO 3430
3420  PRINT "TORPEDO MISSED"
3430  GOSUB 3790
3440  IF E<0 THEN 4000
3450  GOTO 1270
3460  IF D[7] >= 0 THEN 3490
3470  PRINT "SHIELD CONTROL IS NON-OPERATIONAL"
3480  GOTO 1270
3489  REM added return
3490  PRINT "ENERGY AVAILABLE ="E+S
3492  PRINT "NUMBER OF UNITS TO SHIELDS ";
3500  INPUT X
3510  IF X <= 0 THEN 1270
3520  IF E+S-X<0 THEN 3490
3530  LET E=E+S-X
3540  LET S=X
3550  GOTO 1270
3560  IF D[6] >= 0 THEN 3590
3570  PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
3580  GOTO 1270
3590  PRINT
3600  PRINT "DEVICE        STATE OF REPAIR"
3610  FOR F=1 TO 8
3620  GOSUB 5610
3630  PRINT " ",D[F]
3640  NEXT F
3650  PRINT
3660  GOTO 1270
3670  PRINT "SHORT RANGE SENSORS REPORT NO KLINGONS IN THIS QUANDRANT"
3680  GOTO 1270
3688  REM print using/image converted, changed text slightly
3690  PRINT "*** KLINGON AT SECTOR";
3691  LET V[4]=K[I,1]
3692  LET V[5]=K[I,2]
3693  GOSUB 9000
3694  PRINT "DESTROYED ***"
3710  LET P[1]=P[1]-1
3720  LET P[3]=P[3]-1
3730  REM string "   " insertion removed
3740  LET A[INT(K[I,1]+.5),INT(K[I,2]+.5)]=0
3770  LET G[Q[1],Q[2]]=P[1]*100+B[1]*10+S[3]
3780  RETURN
3790  IF C#3 THEN 3820
3800  PRINT "STAR BASE SHIELDS PROTECT THE ENTERPRISE"
3810  RETURN
3820  IF P[1] <= 0 THEN 3910
3830  FOR I=1 TO 3
3840  IF K[I,3] <= 0 THEN 3900
3850  LET H=(K[I,3]/FND(0))*(2*RND(1))
3860  LET S=S-H
3868  REM print using/image converted
3870  LET Z=H
3871  GOSUB 9400
3872  PRINT " UNIT HIT ON ENTERPRISE AT SECTOR";
3873  LET V[4]=K[I,1]
3874  LET V[5]=K[I,2]
3875  GOSUB 9000
3876  PRINT TAB(41);"(";
3877  LET Z=S
3878  GOSUB 9400
3879  PRINT " LEFT)"
3890  IF S<0 THEN 4000
3900  NEXT I
3910  RETURN
3920  PRINT "THE ENTERPRISE IS DEAD IN SPACE. IF YOU SURVIVE ALL";
3922  PRINT " IMPENDING"
3930  PRINT "ATTACK YOU WILL BE DEMOTED TO THE RANK OF PRIVATE"
3940  IF P[1] <= 0 THEN 4020
3950  GOSUB 3790
3960  GOTO 3940
3970  PRINT
3980  PRINT "IT IS STARDATE"T
3990  GOTO 4020
4000  PRINT
4010  PRINT "THE ENTERPRISE HAS BEEN DESTROYED. THE FEDERATION WILL";
4012  PRINT " BE CONQUERED"
4019  REM mod for number print
4020  PRINT "THERE ARE STILL ";
4021  LET Z=P[3]
4022  GOSUB 9400
4023  PRINT " KLINGON BATTLE CRUISERS"
4030  GOTO 230
4040  PRINT
4050  PRINT "THE LAST KLIGON BATTLE CRUISER IN THE GALAXY HAS BEEN";
4052  PRINT " DESTROYED"
4060  PRINT "THE FEDERATION HAS BEEN SAVED !!!"
4070  PRINT
4080  PRINT "YOUR EFFICIENCY RATING ="((P[2]/(T-T[1]))*1000)
4110  GOTO 230
4120  FOR I=S[1]-1 TO S[1]+1
4130  FOR J=S[2]-1 TO S[2]+1
4140  IF I<1 OR I>8 OR J<1 OR J>8 THEN 4200
4150  REM string ">!<" comparison removed
4160  IF A[INT(I+.5),INT(J+.5)]=3 THEN 4240
4200  NEXT J
4210  NEXT I
4220  LET D=0
4230  GOTO 4310
4240  LET D=1
4249  REM docked
4250  LET C=3
4260  LET E=3000
4270  LET P=10
4280  PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES"
4290  LET S=0
4300  GOTO 4380
4310  IF P[1]>0 THEN 4350
4320  IF E<K*.1 THEN 4370
4329  REM green
4330  LET C=0
4340  GOTO 4380
4349  REM red
4350  LET C=2
4360  GOTO 4380
4369  REM yellow
4370  LET C=1
4380  IF D[2] >= 0 THEN 4430
4390  PRINT
4400  PRINT "*** SHORT RANGE SENSORS ARE OUT ***"
4410  PRINT
4420  GOTO 4530
4425  REM this section has been completely rewritten
4426  REM sub at 9000 prints coordinates as in other print using conv.
4427  REM sub at 9200 prints next line of D[x,y] replacing strings
4428  REM V[3] indexes Y line, start at 0 (9200 increments first)
4429  REM changed some of the text ordering and formatting here
4430  PRINT "-=--=--=--=--=--=--=--=-"
4432  LET V[3]=0
4440  GOSUB 9200
4445  PRINT
4450  GOSUB 9200
4455  PRINT " STARDATE "T
4460  GOSUB 9200
4461  PRINT " CONDITION ";
4462  IF C=1 THEN 4467
4463  IF C=2 THEN 4469
4464  IF C=3 THEN 4471
4465  PRINT "GREEN"
4466  GOTO 4472
4467  PRINT "YELLOW"
4468  GOTO 4472
4469  PRINT "RED"
4470  GOTO 4472
4471  PRINT "DOCKED"
4472  GOSUB 9200
4473  PRINT " QUADRANT ";
4474  LET V[4]=Q[1]
4475  LET V[5]=Q[2]
4476  GOSUB 9000
4477  PRINT
4480  GOSUB 9200
4481  PRINT " SECTOR   ";
4482  LET V[4]=S[1]
4483  LET V[5]=S[2]
4484  GOSUB 9000
4485  PRINT
4490  GOSUB 9200
4495  PRINT " ENERGY   "INT(E)
4500  GOSUB 9200
4505  PRINT " SHIELDS  "INT(S)
4510  GOSUB 9200
4515  PRINT " PHOTON TORPEDOES"P
4520  PRINT "-=--=--=--=--=--=--=--=-"
4530  RETURN
4620  REM computer...
4630  IF D[8] >= 0 THEN 4660
4640  PRINT "COMPUTER DISABLED"
4650  GOTO 1270
4660  PRINT "COMPUTER ACTIVE AND AWAITING COMMAND ";
4670  INPUT A
4672  REM added, calc mode off
4673  LET V[6]=0
4680  IF A=0 THEN 4740
4681  IF A=1 THEN 4830
4682  IF A=2 THEN 4880
4690  PRINT
4692  PRINT "FUNCTIONS AVAILABLE FROM COMPUTER"
4700  PRINT "   0 = CUMULATIVE GALATIC RECORD"
4710  PRINT "   1 = STATUS REPORT"
4720  PRINT "   2 = PHOTON TORPEDO DATA"
4730  GOTO 4660
4738  REM print using/image statements converted
4740  PRINT "COMPUTER RECORD OF GALAXY FOR QUADRANT";
4741  LET V[4]=Q[1]
4742  LET V[5]=Q[2]
4743  GOSUB 9000
4744  PRINT
4767  REM converted to x,y array specs
4770  PRINT "----- ----- ----- ----- ----- ----- ----- -----"
4780  FOR I=1 TO 8
4790  PRINT Z[1,I];Z[2,I];Z[3,I];Z[4,I];Z[5,I];Z[6,I];Z[7,I];Z[8,I]
4800  PRINT "----- ----- ----- ----- ----- ----- ----- -----"
4810  NEXT I
4820  GOTO 1270
4830  PRINT
4832  PRINT "   STATUS REPORT"
4834  PRINT
4840  PRINT "NUMBER OF KLINGONS LEFT  ="P[3]
4850  PRINT "NUMBER OF STARDATES LEFT ="(T[1]+T[2])-T
4860  PRINT "NUMBER OF STARBASES LEFT ="B[2]
4870  GOTO 3560
4880  REM PRINT removed
4890  LET Q=0
4900  FOR I=1 TO 3
4910  IF K[I,3] <= 0 THEN 5260
4918  REM reversed for x/y mods
4920  LET A=S[1]
4930  LET B=S[2]
4940  LET X=K[I,1]
4950  LET W=K[I,2]
4960  GOTO 5010
4968  REM print using/image converted
4970  PRINT "YOU ARE AT QUADRANT";
4971  LET V[4]=Q[1]
4972  LET V[5]=Q[2]
4973  GOSUB 9000
4974  PRINT "SECTOR";
4975  LET V[4]=S[1]
4976  LET V[5]=S[2]
4977  GOSUB 9000
4978  PRINT
4990  PRINT "SHIP'S & TARGET'S COORDINATES ARE ";
4995  REM reversed for x,y entry, int mod
5000  INPUT A,B,X,W
5010  LET X=INT(X-A+.5)
5020  LET A=INT(B-W+.5)
5030  IF X<0 THEN 5130
5040  IF A<0 THEN 5190
5050  IF X>0 THEN 5070
5060  IF A=0 THEN 5150
5070  LET B=1
5080  IF ABS(A) <= ABS(X) THEN 5110
5090  PRINT "DIRECTION ="B+(((ABS(A)-ABS(X))+ABS(A))/ABS(A))
5100  GOTO 5240
5110  PRINT "DIRECTION ="B+(ABS(A)/ABS(X))
5120  GOTO 5240
5130  IF A>0 THEN 5170
5140  IF X=0 THEN 5190
5150  LET B=5
5160  GOTO 5080
5170  LET B=3
5180  GOTO 5200
5190  LET B=7
5200  IF ABS(A) >= ABS(X) THEN 5230
5210  PRINT "DIRECTION ="B+(((ABS(X)-ABS(A))+ABS(X))/ABS(X))
5220  GOTO 5240
5230  PRINT "DIRECTION ="B+(ABS(X)/ABS(A))
5240  PRINT "DISTANCE  ="(SQR(X^2+A^2));
5241  REM added warp units to aid with navigation
5242  IF V[6]#1 THEN 5253
5243  LET L=ABS(X)
5244  IF L>ABS(A) THEN 5246
5245  LET L=ABS(A)
5246  PRINT TAB(28);"(";
5247  GOSUB 9700
5248  PRINT " WARP UNIT";
5249  IF L=1 THEN 5251
5250  PRINT "S";
5251  PRINT ")";
5253  PRINT
5255  IF Q=1 THEN 5320
5260  NEXT I
5270  LET Q=0
5280  PRINT "ENTER 1 TO USE THE CALCULATOR ";
5290  INPUT V[6]
5300  IF V[6]=1 THEN 4970
5320  GOTO 1270
5378  REM find-empty-location sub, strings removed
5380  LET F=INT(RND(1)*8+1)
5390  LET G=INT(RND(1)*8+1)
5400  IF A[F,G]#0 THEN 5380
5410  RETURN
5610  REM ****  PRINTS DEVICE NAME FROM ARRAY *****
5615  REM recoded to remove strings
5620  IF F=1 THEN 5635
5623  IF F=2 THEN 5640
5624  IF F=3 THEN 5645
5625  IF F=4 THEN 5650
5626  IF F=5 THEN 5655
5627  IF F=6 THEN 5660
5628  IF F=7 THEN 5665
5630  PRINT "COMPUTER";
5632  RETURN
5635  PRINT "WARP ENGINES";
5637  RETURN
5640  PRINT "S.R. SENSORS";
5642  RETURN
5645  PRINT "L.R. SENSORS";
5647  RETURN
5650  PRINT "PHASER CNTRL";
5652  RETURN
5655  PRINT "PHOTON TUBES";
5657  RETURN
5660  PRINT "DAMAGE CNTRL";
5662  RETURN
5665  PRINT "SHIELD CNTRL";
5667  RETURN
5820  REM instructions modified to notify of use of X,Y coordinates
5821  REM if A=2 then ENTER # prompts inserted to avoid scrolling
5822  REM messed with the course graphic.
5823  PRINT
5824  PRINT
5825  PRINT "     INSTRUCTIONS:"
5826  PRINT
5830  PRINT "<*> = ENTERPRISE"
5840  PRINT "+++ = KLINGON"
5850  PRINT ">!< = STARBASE"
5860  PRINT " *  = STAR"
5865  PRINT
5870  PRINT "COMMAND 0 = WARP ENGINE CONTROL"
5880  PRINT "  'COURSE IS IN A CIRCULAR NUMERICAL         4    3    2"
5890  PRINT "  VECTOR ARRANGEMENT AS SHOWN.                `.  :  .'"
5900  PRINT "  INTERGER AND REAL VALUES MAY BE               `.:.'"
5910  PRINT "  USED.  THEREFORE COURSE 1.5 IS             5---<*>---1"
5920  PRINT "  HALF WAY BETWEEN 1 AND 2.                     .':`."
5930  PRINT "                                              .'  :  `."
5940  PRINT "  A VECTOR OF 9 IS UNDEFINED, BUT            6    7    8"
5950  PRINT "  VALUES MAY APPROACH 9."
5960  PRINT "                                               COURSE"
5970  PRINT "  ONE 'WARP FACTOR' IS THE SIZE OF"
5980  PRINT "  ONE QUADRANT.  THEREFORE TO GET FROM"
5990  PRINT "  QUADRANT 5,6 TO 5,5 YOU WOULD USE COURSE 3, WARP"
6000  PRINT "  FACTOR 1. COORDINATES ARE SPECIFIED USING X,Y NOTATION"
6002  PRINT "  WITH X 1-8 FROM LEFT-RIGHT AND Y 1-8 FROM TOP-BOTTOM."
6004  IF A#2 THEN 6009
6005  PRINT
6006  PRINT "ENTER A NUMBER TO CONTINUE...  ";
6007  INPUT I
6008  PRINT
6009  PRINT
6010  PRINT "COMMAND 1 = SHORT RANGE SENSOR SCAN"
6020  PRINT "  PRINTS THE QUADRANT YOU ARE CURRENTLY IN, INCLUDING"
6030  PRINT "  STARS, KLINGONS, STARBASES, AND THE ENTERPRISE; ALONG"
6040  PRINT "  WITH OTHER PERTINATE INFORMATION."
6045  PRINT
6050  PRINT "COMMAND 2 = LONG RANGE SENSOR SCAN"
6060  PRINT "  SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
6070  PRINT "  OF THE ENTERPRISE IN THE MIDDLE OF THE SCAN.  THE SCAN"
6080  PRINT "  IS CODED IN THE FORM XXX, WHERE THE UNITS DIGIT IS THE"
6090  PRINT "  NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF STAR-"
6100  PRINT "  BASES, THE HUNDREDS DIGIT IS THE NUMBER OF KLINGONS."
6105  PRINT
6110  PRINT "COMMAND 3 = PHASER CONTROL"
6120  PRINT "  ALLOWS YOU TO DESTROY THE KLINGONS BY HITTING HIM WITH"
6130  PRINT "  SUITABLY LARGE NUMBERS OF ENERGY UNITS TO DEPLETE HIS "
6140  PRINT "  SHIELD POWER.  KEEP IN MIND THAT WHEN YOU SHOOT AT"
6150  PRINT "  HIM, HE GONNA DO IT TO YOU TOO."
6151  IF A#2 THEN 6159
6152  FOR I=1 TO 5
6153  PRINT
6154  NEXT I
6155  PRINT "ENTER A NUMBER TO CONTINUE...  ";
6156  INPUT I
6157  PRINT
6159  PRINT
6160  PRINT "COMMAND 4 = PHOTON TORPEDO CONTROL"
6170  PRINT "  COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
6180  PRINT "  IF YOU HIT THE KLINGON, HE IS DESTROYED AND CANNOT FIRE"
6190  PRINT "  BACK AT YOU.  IF YOU MISS, HE WILL SHOOT HIS PHASERS AT"
6200  PRINT "  YOU."
6210  PRINT "   NOTE: THE LIBRARY COMPUTER (COMMAND 7) HAS AN OPTION"
6220  PRINT "   TO COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)."
6225  PRINT
6230  PRINT "COMMAND 5 = SHIELD CONTROL"
6240  PRINT "  DEFINES NUMBER OF ENERGY UNITS TO ASSIGN TO SHIELDS"
6250  PRINT "  ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY."
6255  PRINT
6260  PRINT "COMMAND 6 = DAMAGE CONTROL REPORT"
6270  PRINT "  GIVES STATE OF REPAIRS OF ALL DEVICES.";
6275  PRINT "  A STATE OF REPAIR"
6280  PRINT "  LESS THAN ZERO SHOWS THAT THAT DEVICE IS TEMPORARALY"
6290  PRINT "  DAMAGED."
6291  IF A#2 THEN 6299
6292  FOR I=1 TO 6
6293  PRINT
6294  NEXT I
6295  PRINT "ENTER A NUMBER TO CONTINUE...  ";
6296  INPUT I
6297  PRINT
6299  PRINT
6300  PRINT "COMMAND 7 = LIBRARY COMPUTER"
6310  PRINT "  THE LIBRARY COMPUTER CONTAINS THREE OPTIONS:"
6320  PRINT "    OPTION 0 = CUMULATIVE GALACTIC RECORD"
6330  PRINT "     SHOWS COMPUTER MEMORY OF THE RESULTS OF ALL PREVIOUS"
6340  PRINT "     LONG RANGE SENSOR SCANS"
6350  PRINT "    OPTION 1 = STATUS REPORT"
6360  PRINT "     SHOWS NUMBER OF KLINGONS, STARDATESC AND STARBASES"
6370  PRINT "     LEFT."
6380  PRINT "    OPTION 2 = PHOTON TORPEDO DATA"
6390  PRINT "     GIVES TRAJECTORY AND DISTANCE BETWEEN THE ENTERPRISE"
6400  PRINT "     AND ALL KLINGONS IN YOUR QUADRANT"
6401  IF A#2 THEN 6408
6402  FOR I=1 TO 9
6403  PRINT
6404  NEXT I
6408  PRINT
6410  RETURN
8995  REM sub to help convert PRINT USING, displays " x,y "
8996  REM coordinates (V[4],V[5])
9000  PRINT " ";
9010  LET L=INT(V[4]+.5)
9020  GOSUB 9700
9030  PRINT ",";
9040  LET L=INT(V[5]+.5)
9050  GOSUB 9700
9060  PRINT " ";
9070  RETURN
9195  REM print display line from A[x,y]
9196  REM y coord spec'd by V[3], incremented
9200  LET V[3]=V[3]+1
9210  FOR I=1 TO 8
9220  LET A=A[I,V[3]]
9230  IF A=1 THEN 9240
9232  IF A=2 THEN 9242
9233  IF A=3 THEN 9244
9234  IF A=4 THEN 9246
9235  PRINT "   ";
9236  GOTO 9250
9240  PRINT "<*>";
9241  GOTO 9250
9242  PRINT "+++";
9243  GOTO 9250
9244  PRINT ">!<";
9245  GOTO 9250
9246  PRINT " * ";
9250  NEXT I
9260  RETURN
9395  REM Integer print subroutine
9396  REM up to 4 digits -9999 to 9999, no spaces
9397  REM Number to print in Z, L used for digit
9400  IF Z >= 0 THEN 9420
9410  PRINT "-";
9420  LET Z=ABS(Z)
9430  LET Z=INT(Z)
9440  IF Z<10 THEN 9560
9450  IF Z<100 THEN 9530
9460  IF Z<1000 THEN 9500
9470  LET L=INT(Z/1000)
9480  LET Z=Z-L*1000
9490  GOSUB 9700
9500  LET L=INT(Z/100)
9510  LET Z=Z-L*100
9520  GOSUB 9700
9530  LET L=INT(Z/10)
9540  LET Z=Z-L*10
9550  GOSUB 9700
9560  LET L=Z
9570  GOSUB 9700
9580  RETURN
9695  REM Digit print subroutine, digit in L
9700  IF L=1 THEN 9810
9710  IF L=2 THEN 9830
9720  IF L=3 THEN 9850
9730  IF L=4 THEN 9870
9740  IF L=5 THEN 9890
9750  IF L=6 THEN 9910
9760  IF L=7 THEN 9930
9770  IF L=8 THEN 9950
9780  IF L=9 THEN 9970
9790  PRINT "0";
9800  RETURN
9810  PRINT "1";
9820  RETURN
9830  PRINT "2";
9840  RETURN
9850  PRINT "3";
9860  RETURN
9870  PRINT "4";
9880  RETURN
9890  PRINT "5";
9900  RETURN
9910  PRINT "6";
9920  RETURN
9930  PRINT "7";
9940  RETURN
9950  PRINT "8";
9960  RETURN
9970  PRINT "9";
9980  RETURN
9999  END

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

Michael Birken

Unknown
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150224.1 | Last Updated 29 Jul 2008
Article Copyright 2008 by Michael Birken
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid