Space Trek

Products: Space Trek
Date: 1982
Type: Program
Platform(s): TS 1000
Tags: Game

This is a space strategy game called SPACETREK in which the player commands the starship Endeavour against an invasion of “Drakons” across an 8×8 galaxy grid. The galaxy is initialised as a two-dimensional array A(8,8) where each cell encodes Drakon count (hundreds), starbase count (tens), and star count (units) in a single integer. Navigation uses an eight-direction compass system with diagonal movement scaled by square root of 2 via INT(SQR(WA*2)), and the viewport displays a 10×18 play area using inverse-video block graphics for stars, starbases, Drakons, and the player’s ship. Five difficulty levels adjust the random Drakon population and the stardate limit, while energy, torpedoes, and shields are tracked with docking at adjacent starbases restoring full resources.


Program Analysis

Program Structure

The program is organised into clearly separated subroutines accessed via GOSUB from a central command loop. The top-level flow is:

  1. Lines 5–195: Title screen, instructions prompt, difficulty selection, and galaxy initialisation.
  2. Lines 200–290: Main command loop — display status (GOSUB 1000), accept command, dispatch to subroutine.
  3. Lines 1000–1260: Status/viewport display subroutine.
  4. Lines 2000–2320: Helm (warp movement) subroutine.
  5. Lines 2500–2720: Long-range scan subroutine.
  6. Lines 2800–2920: Docking/crash detection subroutine.
  7. Lines 3000–3260: Phaser combat subroutine.
  8. Lines 3300–3310: Low-shield warning subroutine.
  9. Lines 6000–6060: Random Drakon attack subroutine (called each turn).
  10. Lines 6100–6850: End-game conditions (resignation, energy loss, shield loss, time out, victory, crash).
  11. Lines 7000–7160: Galaxy and ship initialisation.
  12. Lines 7300–7380: Shield recharge subroutine.
  13. Lines 8000–8140: Sector population subroutine (places objects in B()).
  14. Lines 8200–8480: Photon torpedo subroutine.
  15. Lines 9000–9600: Instructions display.

Galaxy Encoding

The two-dimensional array A(8,8) stores each sector’s contents as a single packed integer. Hundreds digit = Drakon count, tens digit = starbase count, units digit = star count. For example, a value of 213 means 2 Drakons, 1 starbase, 3 stars. This is decoded at line 8000:

  • Y = INT(X/100) — Drakons
  • Z = INT((X - Y*100)/10) — Starbases
  • W = X - Y*100 - Z*10 — Stars

The total galaxy Drakon count K is accumulated during initialisation at line 7070. When a Drakon or starbase is destroyed, A(Q(1),Q(2)) is decremented by 100 or 10 respectively to keep the map in sync.

Navigation System

Movement uses eight compass directions (1=N, 2=NE, 3=E, etc.). Diagonal movement (directions 2, 4, 6, 8) has its warp factor reduced by INT(SQR(WA*2)) at line 2080, approximating the √2 factor for diagonal grid travel. Column (L) and row (M) are updated simultaneously using Boolean arithmetic:

  • Line 2090: L = L + (DI=2 OR DI=3 OR DI=4)*WA - (DI=6 OR DI=7 OR DI=8)*WA
  • Line 2100: M = M - (DI=1 OR DI=2 OR DI=8)*WA + (DI=4 OR DI=5 OR DI=6)*WA

When the ship exits the viewport boundaries, the sector coordinates Q(1) and Q(2) are updated with wrap-around logic (lines 2110–2180), and the viewport position is adjusted to re-enter from the opposite edge. If still out of bounds after adjustment, the correction loop at line 2250 repeats.

Viewport and Display

The play area occupies rows 3–12, columns 1–18 of the screen (a 10-row by 18-column box). It is drawn at line 1040–1080 using inverse-space characters (\@@) for the border. Objects are rendered using inverse-video characters: %* for stars, %O for the ship, %V for Drakons, and %X for starbases. Ship status is displayed in a sidebar at columns 21+ (lines 1190–1240). The message area occupies rows 14–21.

Object Placement Array

On entering a sector (GOSUB 8000), all objects are randomly placed into the array B(W+Y+Z, 2) where the first index is the object number and the second index holds row (column 1) and column (column 2). The ordering is: indices 1–W = stars, W+1 to W+Z = starbases, W+Z+1 to W+Z+Y = Drakons. A collision-avoidance loop at lines 8100–8120 ensures no two objects share the same cell and no object is placed at the ship’s current position.

Combat Mechanics

Phasers (command 3): Damage is calculated as E1 = INT(E/Y/((DIST+1)*10)) where DIST is the Euclidean distance to the first Drakon. Energy cost is 300 per Drakon present. The number of surviving Drakons is computed from remaining Drakon hit-points G at line 3135. Drakon return fire at lines 3160–3215 has a 1-in-12 chance of missing entirely (line 3180).

Photon torpedoes (command 4): A torpedo travels step-by-step through the viewport in the chosen direction (lines 8270–8340), printing %+ at each cell visited. It checks all objects at each step (line 8300) and branches on hit type: star = absorbed, starbase = destroyed (penalty), Drakon = destroyed. After a hit or miss, execution falls through to line 3150 to handle post-combat Drakon retaliation.

Docking and Repair

Docking detection in subroutine 2800 checks whether the ship is within a Chebyshev distance of 1 from any starbase (i.e., in an adjacent or diagonal cell). The condition at line 2820 uses ABS(M-B(D,1)<=1) — note this is a bug: the closing parenthesis should enclose only the subtraction expression, giving ABS(M-B(D,1))<=1; as written, the Boolean result of the comparison is taken as the argument to ABS, which always evaluates to 0 or 1 and so the condition is always true for the ABS part. When docking is correctly triggered, energy is restored to 3000, torpedoes to 15 (capped), and shields to 100.

Long-Range Scan

The long-range scan (command 2) displays a 3×3 neighbourhood of sectors around the current position. It marks sectors as scanned in the F(8,8) array (set to -1 at line 2540). Sectors not yet scanned are shown as blanks. The current sector is highlighted with \@@\@@\@@. A POKE 16437,255 at line 2670 clears the keyboard buffer (a standard ZX81/TS1000 idiom) before returning.

Difficulty Scaling

The five difficulty levels affect two parameters during galaxy generation:

DEGLabelMax Drakons/sectorStardate range
1Easy0–1350–449
2Fairly Hard0–2350–549
3Hard0–3350–649
4Very Hard0–4350–749
5Impossible0–5350–849

Higher difficulty levels produce more Drakons overall but also grant more time — a deliberate trade-off making longer games harder to sustain.

Notable Bugs and Anomalies

  • Docking condition (line 2820): ABS (M-B(D,1)<=1) has misplaced parentheses. The intended expression is ABS(M-B(D,1))<=1. As written, docking may trigger or fail unpredictably.
  • Crash check (line 2830): Tests L=B(D,1) AND M=B(D,2) but B(D,1) is the row and B(D,2) is the column — the coordinates are swapped compared to how they are used elsewhere, potentially causing missed crash detection.
  • Phaser distance (line 3110): Only calculates distance to B(1,1)/B(1,2) (the first object, a star), not the nearest Drakon, making phaser effectiveness independent of actual Drakon positions.
  • Variable G initialisation: G (total Drakon strength) is set at line 8035 as 200*Y but is also set independently in subroutines 6000 and 8200. If GOSUB 8000 is not called before combat (e.g. after certain movement paths), G may be stale.
  • Line 3145 date decrement: DATE is decremented by 2 during phaser fire, then GOSUB 8000 re-populates the sector, which also decrements DATE by 2 more (via line 2885 in GOSUB 2800… actually line 2885 is in subroutine 2800, not 8000 — but subroutine 8000 does not call 2800, so this is not an issue). The date management across subroutines is inconsistent.
  • Line 3000 guard condition: IF Y<>0 AND E<>0 THEN GOTO 3060 — if both conditions are met the code jumps past the “no Drakons” warning but the order of the conditions means energy is checked as a separate guard at line 3005 only if Y=0, leaving a path where Y=0 and E>0 wastes 500 energy correctly but Y>0 and E=0 jumps to 3060 and fires anyway.

Content

Appears On

Related Products

You are in command of the Starship Endeavor and the Galaxy, made up of 64 sectors, is being invaded by...

Related Articles

Related Content

Image Gallery

Source Code

   5 DIM F(8,8)
  10 PRINT AT 8,10;":'''''''''''''''''''''''':"
  15 LET DOCK=0
  16 LET CH=0
  20 PRINT TAB 10;":  SPACETREK  :"
  30 PRINT TAB 10;":........................:"
  40 PRINT AT 15,3;"DO YOU WANT INSTRUCTIONS?"
  50 PRINT 
  60 PRINT "1.YES"
  70 PRINT "2.NO"
  80 INPUT INST
  90 IF INST=1 THEN GOSUB 9000
  95 IF INST<1 OR INST>2 THEN GOTO 80
  96 CLS 
 100 PRINT "WHAT DEGREE OF DIFFICULTY?"
 105 PRINT "1. EASY"
 106 PRINT "2. FAIRLY HARD"
 107 PRINT "3. HARD"
 108 PRINT "4. VERY HARD"
 109 PRINT "5. IMPOSSIBLE"
 115 INPUT DEG
 116 IF DEG<1 OR DEG>5 THEN GOTO 115
 120 CLS 
 130 FAST 
 140 GOSUB 7000
 150 GOSUB 8000
 155 SLOW 
 160 PRINT AT 3,1;K;" DRAKONS ARE INVADING THE"
 170 PRINT TAB 12;"GALAXY"
 180 PRINT 
 190 PRINT TAB 10;"%G%O%O%D% %L%U%C%K"
 192 PRINT 
 194 PRINT TAB 5;"PRESS NEWLINE TO START"
 195 INPUT A$
 200 CLS 
 210 GOSUB 1000
 220 INPUT COM
 225 IF E<=0 OR DATE<=0 THEN GOTO 6500
 230 IF COM=1 THEN GOSUB 2000
 240 IF COM=2 THEN GOSUB 2500
 250 IF COM=3 THEN GOSUB 3000
 260 IF COM=4 THEN GOSUB 8200
 270 IF COM=5 THEN GOSUB 7300
 280 IF COM=6 THEN GOTO 6100
 285 GOSUB 6000
 286 LET CH=0
 290 GOTO 220
 1000 PRINT AT 0,0;"CONDITION ";
 1002 PRINT AT 0,0;"CONDITION ";
 1004 IF Y=0 THEN LET C=1
 1005 IF Y<>0 THEN LET C=2
 1006 IF DOCK=-1 THEN LET C=3
 1010 IF C=1 THEN PRINT "GREEN "
 1020 IF C=2 THEN PRINT "%R%E%D   "
 1030 IF C=3 THEN PRINT "DOCKED"
 1032 LET DOCK=0
 1040 PRINT AT 2,0;"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
 1050 FOR J=1 TO 10
 1060 PRINT "@@% % % % % % % % % % % % % % % % % % @@"
 1070 NEXT J
 1080 PRINT "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
 1090 FOR J=1 TO W
 1100 PRINT AT B(J,1),B(J,2);"%*"
 1110 NEXT J
 1120 FOR J=W+1 TO W+Z
 1130 PRINT AT B(J,1),B(J,2);"%X"
 1140 NEXT J
 1150 FOR J=W+Z+1 TO W+Z+Y
 1160 PRINT AT B(J,1),B(J,2);"%V"
 1170 NEXT J
 1180 PRINT AT M,L;"%O"
 1190 PRINT AT 0,18;"SECTOR ";Q(1);",";Q(2)
 1200 PRINT AT 3,21;"ENERGY";TAB 21;E;"  "
 1210 PRINT AT 5,21;"TORPEDOES";TAB 21;T;" "
 1220 PRINT AT 7,21;"SHIELDS";TAB 21;S;"  "
 1230 PRINT AT 9,21;"DRAKONS";TAB 21;K;"  "
 1240 PRINT AT 11,21;"STARDATE";TAB 21;DATE;"  "
 1242 PRINT AT 14,0;"                                "
 1243 FOR J=1 TO 7
 1245 PRINT "                                "
 1248 NEXT J
 1250 PRINT AT 15,9;"%C%O%M%M%A%N%D%?"
 1255 IF S<15 THEN GOSUB 3300
 1256 SLOW 
 1260 RETURN 
 2000 PRINT AT 15,9;"        "
 2005 LET CH=0
 2010 PRINT AT 15,0;"WARP (1-20)?"
 2020 INPUT WA
 2025 IF WA<0 OR WA>20 OR E<WA THEN GOTO 2020
 2030 PRINT AT 15,5;WA;"      "
 2040 IF WA=0 THEN GOTO 1000
 2050 PRINT AT 17,0;"DIRECTION (1-8)?"
 2060 INPUT DI
 2065 IF DI<1 OR DI>8 THEN GOTO 2060
 2070 PRINT AT 17,11;DI;"      "
 2080 IF DI=2 OR DI=4 OR DI=6 OR DI=8 THEN LET WA=INT (SQR (WA*2))
 2090 LET L=L+(DI=2 OR DI=4 OR DI=3)*WA-(DI=6 OR DI=7 OR DI=8)*WA
 2100 LET M=M-(DI=1 OR DI=2 OR DI=8)*WA+(DI=4 OR DI=5 OR DI=6)*WA
 2110 IF M>12 THEN LET Q(1)=Q(1)-1
 2120 IF Q(1)>8 THEN LET Q(1)=Q(1)+8
 2130 IF M<3 THEN LET Q(1)=Q(1)+1
 2140 IF Q(1)<1 THEN LET Q(1)=Q(1)+8
 2150 IF L>18 THEN LET Q(2)=Q(2)+1
 2160 IF Q(2)>8 THEN LET Q(2)=Q(2)-8
 2170 IF L<1 THEN LET Q(2)=Q(2)-1
 2180 IF Q(2)<1 THEN LET Q(2)=Q(2)+8
 2190 LET DATE=DATE-INT (WA/4)
 2200 IF M>12 OR M<3 OR L>18 OR L<1 THEN LET CH=-1
 2205 IF CH=-1 THEN FAST 
 2210 IF M>12 THEN LET M=M-10
 2220 IF M<3 THEN LET M=M+10
 2230 IF L>18 THEN LET L=L-18
 2240 IF L<1 THEN LET L=L+18
 2250 IF M>12 OR M<3 OR L>18 OR L<1 THEN GOTO 2110
 2280 LET E=E-2*WA
 2290 IF CH=-1 THEN GOSUB 8000
 2295 FOR D=1 TO W+Y+Z
 2300 IF M=B(D,1) AND L=B(D,2) AND CH<>-1 THEN GOTO 6800
 2301 NEXT D
 2305 GOSUB 2800
 2310 GOSUB 1000
 2315 SLOW 
 2320 RETURN 
 2500 CLS 
 2505 FAST 
 2510 PRINT AT 0,8;"%L%O%N%G% %R%A%N%G%E% %S%C%A%N%."
 2520 PRINT AT 1,0;"''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"
 2525 FOR J=-1 TO 1
 2530 FOR D=-1 TO 1
 2532 LET ZZ=Q(1)-J
 2534 LET YY=Q(2)+D
 2540 IF (ZZ>0 AND ZZ<9 AND YY>0 AND YY<9) THEN LET F(ZZ,YY)=-1
 2550 NEXT D
 2560 NEXT J
 2570 FOR J=2 TO 16 STEP 2
 2580 FOR D=0 TO 28 STEP 4
 2590 IF F(J/2,(D+4)/4)=-1 THEN PRINT AT 18-J,D;A(J/2,(D+4)/4)
 2600 IF F(J/2,(D+4)/4)<>-1 THEN PRINT AT 18-J,D;"% % % % "
 2610 NEXT D
 2620 NEXT J
 2630 PRINT AT 18-Q(1)*2,Q(2)*4-4;"@@@@@@"
 2640 PRINT AT 17,0;"................................................................"
 2650 PRINT "MR SPARK REPORTS YOU ARE IN"
 2655 PRINT "SECTOR ";Q(1);",";Q(2)
 2660 SLOW 
 2665 PAUSE 300
 2670 POKE 16437,255
 2680 CLS 
 2690 LET DATE=DATE-1
 2700 LET E=E-3
 2710 GOSUB 1000
 2720 RETURN 
 2800 LET DOCK=0
 2805 LET CRASH=0
 2810 FOR D=W+1 TO W+Z
 2820 IF ABS (M-B(D,1)<=1) AND ABS (L-B(D,2))<=1 THEN LET DOCK=-1
 2830 IF CH=0 AND L=B(D,1) AND M=B(D,2) THEN LET CRASH=-1
 2840 IF CRASH=-1 THEN GOTO 6500
 2880 NEXT D
 2885 LET DATE=DATE-2
 2888 IF DOCK=0 THEN RETURN 
 2890 LET E=3000
 2900 LET T=T+2
 2905 IF T>15 THEN LET T=15
 2910 LET S=100
 2920 RETURN 
 3000 IF Y<>0 AND E<>0 THEN GOTO 3060
 3005 IF E<=0 THEN GOTO 6500
 3010 PRINT AT 15,9;"NO DRAKONS."
 3020 PRINT 
 3030 PRINT "ENERGY WASTED=500"
 3035 LET E=E-500
 3036 IF E<=0 THEN GOTO 6500
 3040 GOSUB 1000
 3050 RETURN 
 3060 PRINT AT 15,6;"PHASERS LOCKED IN."
 3070 FOR D=1 TO 25
 3075 PRINT AT 17,11;"FIRING"
 3076 FOR J=1 TO 2
 3077 NEXT J
 3079 PRINT AT 17,11;"@@@@@@@@@@@@"
 3080 NEXT D
 3100 PRINT AT 17,11;"%F%I%R%E%D "
 3110 LET DIST=INT (SQR ((ABS (B(1,1)-M))**2+(ABS (B(1,2)-L))**2))
 3120 LET E1=INT (E/Y/((DIST+1)*10))
 3125 LET E=E-300*Y
 3130 LET G=G-E1
 3135 LET K=K-(Y-(INT (G/200)))
 3140 LET A(Q(1),Q(2))=(INT (G/200))*100+Z*10+W
 3145 LET DATE=DATE-2
 3146 IF DATE=0 THEN GOTO 6500
 3150 GOSUB 8000
 3155 IF Y=0 THEN GOTO 3220
 3156 PRINT AT 17,11;"                                                     "
 3160 IF Y<>0 THEN PRINT AT 15,6;"DRAKONS FIRING BACK"
 3162 PRINT "                                                                "
 3170 LET RD=INT (RND*12)
 3180 IF RD=11 THEN GOTO 3250
 3184 IF S<=5 THEN GOTO 6500
 3185 PRINT AT 17,4;"ENDEAVOUR HAS BEEN HIT"
 3187 PRINT AT 19,6;"                 "
 3190 LET E=E-INT (G*3/DIST)
 3200 IF E<=0 THEN GOTO 6500
 3210 LET S=S-INT (G/(12-(RND*4)))
 3215 IF S<0 THEN LET S=0
 3220 IF Y=0 THEN PRINT AT 15,1;"ALL DRAKONS IN THIS SECTOR","           %D%E%S%T%R%O%Y%E%D                                                                           "
 3230 GOSUB 1000
 3240 RETURN 
 3250 PRINT TAB 6;"DRAKONS HAVE MISSED"
 3260 GOTO 3230
 3300 PRINT AT 19,12;"MR SCOTCH";TAB 2;"REPORTS SHIELDS AT LOW POWER"
 3310 RETURN 
 6000 IF CH=-1 OR RND*8>4 OR Y=0 THEN RETURN 
 6005 PRINT AT 15,6;"HELM REPORTS THAT","THE ENDEAVOUR IS UNDER ATTACK."
 6010 LET G=200*Y
 6020 LET S=S-INT (G/(RND*4+6))
 6030 LET E=E-INT (G/(RND*4.5))
 6040 IF S<=0 OR E<=0 THEN GOTO 6500
 6050 GOSUB 1000
 6060 RETURN 
 6100 CLS 
 6110 PRINT AT 3,6;"RESIGNATION ACCEPTED"
 6115 PRINT 
 6120 GOTO 6710
 6500 CLS 
 6501 SLOW 
 6505 IF E<=0 THEN GOTO 6530
 6510 IF S<=0 THEN GOTO 6610
 6515 IF DATE<=0 THEN GOTO 6680
 6520 IF K=0 THEN GOTO 6750
 6530 PRINT "THE ENDEAVOUR IS LYING DEAD IN"
 6532 PRINT "SPACE DUE TO LACK OF ENERGY."
 6534 PRINT "YOU AND YOUR CREW HAVE DIED AS"
 6536 PRINT "THE LIFE SUPPORT SYSTEMS ARE"
 6538 PRINT "INOPERATIVE."
 6540 PRINT "THE ENDEAVOUR IS CAPTURED BY"
 6542 PRINT "THE DRAKONS."
 6544 GOTO 6700
 6610 PRINT "THE ENDEAVOUR WAS CAUGHT WITH"
 6620 PRINT "ITS SHIELDS DOWN. YOU HAVE BEEN"
 6625 PRINT TAB 11;"%D%E%S%T%R%O%Y%E%D"
 6650 GOTO 6700
 6680 PRINT "STARFLEET COMMAND REPORTS"
 6682 PRINT TAB 8;"""TIME HAS RUN OUT"""
 6684 PRINT "THE DRAKONS HAVE CAPTURED THE"
 6690 PRINT "FEDERATIONS HEADQUARTERS..."
 6695 PRINT 
 6700 PRINT TAB 12;"%Y%O%U% %L%O%S%E"
 6705 PRINT 
 6710 PRINT "ANOTHER GAME? (Y OR N)"
 6720 INPUT A$
 6725 IF A$="Y" THEN CLS 
 6730 IF A$="Y" THEN RUN 
 6740 STOP 
 6750 PRINT "WELL DONE CAPTAIN. YOU HAVE"
 6752 PRINT "DESTROYED ALL THE DRAKONS IN"
 6754 PRINT "THE GALAXY."
 6756 PRINT "YOU HAVE BEEN PROMOTED TO..."
 6758 PRINT TAB 11;"%C%O%M%M%A%N%D%E%R"
 6760 PRINT 
 6770 PRINT TAB 12;"%Y%O%U% %W%I%N"
 6772 PRINT 
 6774 GOTO 6710
 6800 CLS 
 6810 PRINT "YOU HAVE CRASHED THE ENDEAVOUR"
 6820 PRINT "INTO A ";
 6825 IF D<=W THEN PRINT "STAR "
 6830 IF D>=W+1 AND D<=W+Z THEN PRINT "STARBASE "
 6835 IF D>W+Z THEN PRINT "DRAKON "
 6840 PRINT 
 6845 SLOW 
 6850 GOTO 6700
 7000 LET K=0
 7010 DIM A(8,8)
 7015 DIM Q(2)
 7020 FOR X=1 TO 8
 7030 FOR Y=1 TO 8
 7040 LET B=INT (RND*7+3)
 7050 LET B=B+10*INT (RND*2)
 7060 LET B=B+100*INT (RND*(DEG+1))
 7070 LET K=K+INT (B/100)
 7080 LET A(X,Y)=B
 7090 NEXT Y
 7100 NEXT X
 7105 LET DATE=INT (DEG*100*RND+350)
 7106 LET C=1
 7110 LET E=3000
 7120 LET T=15
 7130 LET S=100
 7140 LET Q(1)=INT (RND*8+1)
 7145 LET Q(2)=INT (RND*8+1)
 7150 LET M=INT (RND*10+3)
 7155 LET L=INT (RND*18+1)
 7160 RETURN 
 7300 IF E>1200 THEN LET S=100
 7310 IF E>1200 THEN LET E=E-600
 7320 LET DATE=DATE-1
 7325 IF E>1200 THEN GOTO 7335
 7326 IF E<1200 THEN LET E=E-INT (6*(100-S))
 7330 IF E<1200 THEN LET S=S+INT (E/12)
 7333 IF E<=0 THEN GOTO 6500
 7335 PRINT AT 19,0;"                                                                "
 7340 IF S>100 THEN LET S=100
 7360 IF S=100 THEN PRINT AT 15,6;"SHIELDS AT FULL POWER"
 7370 GOSUB 1000
 7380 RETURN 
 8000 IF Q(1)<1 THEN LET Q(1)=1
 8002 IF Q(1)>8 THEN LET Q(1)=8
 8004 IF Q(2)<1 THEN LET Q(2)=1
 8006 IF Q(2)>8 THEN LET Q(2)=8
 8008 LET X=A(Q(1),Q(2))
 8010 LET Y=INT (X/100)
 8020 LET Z=INT ((X-(Y*100))/10)
 8030 LET W=X-Y*100-Z*10
 8035 LET G=200*Y
 8040 DIM B(W+Y+Z,2)
 8050 LET B(1,2)=INT (RND*18+1)
 8060 LET B(1,1)=INT (RND*10+3)
 8070 FOR J=2 TO W+Y+Z
 8080 LET B(J,2)=INT (RND*18+1)
 8090 LET B(J,1)=INT (RND*10+3)
 8100 FOR D=1 TO J-1
 8110 IF (B(J,1)=B(D,1) AND B(J,2)=B(D,2)) OR (B(J,1)=L AND B(J,2)=M) THEN GOTO 8080
 8120 NEXT D
 8130 NEXT J
 8140 RETURN 
 8200 IF T=0 THEN LET E=E-400
 8205 LET G=Y*200
 8206 LET DIST=10
 8210 IF E<=0 THEN GOTO 6500
 8212 IF T=0 THEN GOSUB 1000
 8215 IF T=0 THEN RETURN 
 8216 IF Y=0 THEN PRINT AT 17,0;"NO DRAKONS ENERGY WASTED=500"
 8217 LET E=E-500
 8218 IF Y=0 THEN GOSUB 1000
 8219 IF Y=0 THEN RETURN 
 8220 PRINT AT 15,6;"%P%H%O%T%O%N% %T%O%R%P%E%D%O%E%S"
 8230 PRINT AT 17,0;"DIRECTION (1-8)?"
 8240 INPUT DI
 8244 IF DI<1 OR DI>8 THEN GOTO 8240
 8245 PRINT AT 17,10;" ";DI;"      "
 8246 LET T=T-1
 8250 PRINT AT 19,12;"%F%I%R%E%D"
 8260 LET VX=L
 8265 LET VY=M
 8270 LET VX=VX+(DI=2 OR DI=3 OR DI=4)-(DI=8 OR DI=7 OR DI=6)
 8280 LET VY=VY-(DI=1 OR DI=2 OR DI=8)+(DI=4 OR DI=5 OR DI=6)
 8285 PRINT AT VY,VX;"%+"
 8290 FOR D=1 TO W+Y+Z
 8300 IF (VY=B(D,1) AND VX=B(D,2)) THEN GOTO 8390
 8310 NEXT D
 8320 IF VX<1 OR VX>18 OR VY<3 OR VY>12 THEN GOTO 8350
 8340 GOTO 8270
 8350 PRINT AT 19,12;"%M%I%S%S%E%D"
 8370 GOSUB 1000
 8380 RETURN 
 8390 IF D<=W THEN GOTO 8440
 8400 IF D>=W+1 AND D<=W+Z THEN GOTO 8460
 8410 PRINT AT 19,6;"%D%R%A%K%O%N% %D%E%S%T%R%O%Y%E%D"
 8415 LET K=K-1
 8420 LET A(Q(1),Q(2))=A(Q(1),Q(2))-100
 8430 GOTO 3150
 8440 PRINT AT 19,11;"%A%B%S%O%R%B%E%D"
 8450 GOTO 3150
 8460 PRINT AT 19,3;"YOUVE DESTROYED A STARBASE"
 8470 LET A(Q(1),Q(2))=A(Q(1),Q(2))-10
 8480 GOTO 3150
 9000 CLS 
 9005 PRINT "   YOU ARE IN COMMAND OF THE";TAB 6;"STARSHIP ENDEAVOUR"
 9010 PRINT 
 9020 PRINT "THE GALAXY IS BEING ATTACKED BY"
 9030 PRINT "THE DRAKONS. YOUR MISSION IS TO"
 9040 PRINT "SEEK THEM OUT AND DESTROY THEM."
 9042 PRINT "BEFORE TIME RUNS OUT."
 9043 PRINT 
 9044 PRINT "SYMBOLS ON THE SCREEN ARE:-"
 9045 PRINT 
 9046 PRINT "1. %*=STAR"
 9047 PRINT "2. %O=THE ENDEAVOUR"
 9048 PRINT "3. %V=A DRAKON"
 9049 PRINT "4. %X=A STARBASE"
 9050 PRINT 
 9054 PRINT "YOU HAVE AT YOUR DISPOSAL"
 9060 PRINT "SEVERAL COMMANDS."
 9070 PRINT 
 9080 PRINT "FOR A PRINTOUT OF THESE:-"
 9090 PRINT TAB 9;"PRESS NEWLINE"
 9100 INPUT A$
 9110 CLS 
 9120 PRINT "1. HELM","1.WARP SPEED"
 9130 PRINT ,"2.DIRECTION"
 9140 PRINT "2. LONG RANGE SCAN"
 9150 PRINT "3. PHASERS"
 9160 PRINT "4. PHOTON TORPEDOES"
 9170 PRINT "5. SHIELDS"
 9180 PRINT "6. RESIGNATION"
 9190 PRINT 
 9200 PRINT "DIRECTIONS ARE AS FOLLOWS."
 9205 PRINT 
 9210 PRINT TAB 13;"8 1 2"
 9220 PRINT TAB 13;" '. : .'"
 9230 PRINT TAB 12;"7....:.... 3"
 9240 PRINT TAB 14;". : . "
 9250 PRINT TAB 13;" ' :  '"
 9255 PRINT TAB 13;"6 5 4"
 9260 PRINT 
 9261 PRINT "YOU MAY DOCK WITH STARSHIPS BY"
 9262 PRINT "MOVING INTO THE SQUARE NEXT TO"
 9263 PRINT "IT. YOU ARE THEN REFUELED."
 9264 PRINT 
 9270 PRINT "PRESS NEWLINE TO CONTINUE."
 9280 INPUT A$
 9290 CLS 
 9300 PRINT "THE GALAXY IS DIVIDED UP INTO"
 9310 PRINT "64 SECTORS. THESE ARE NUMBERED "
 9320 PRINT "AS FOLLOWS:-"
 9330 PRINT 
 9340 FOR J=1 TO 8
 9350 PRINT TAB 4;9-J;": "
 9360 NEXT J
 9370 PRINT TAB 5;"''''''''''''''''''"
 9380 PRINT TAB 5;"12345678"
 9390 PRINT 
 9395 PRINT AT 9,10;"% "
 9400 PRINT AT 16,0;"THE NUMBER UP IS GIVEN FIRST."
 9410 PRINT "E.G. THE BLACK SQUARE IS AT 3,6"
 9420 PRINT 
 9430 PRINT "PRESS NEWLINE"
 9435 INPUT A$
 9450 CLS 
 9460 PRINT "THE NUMBER IN EACH SECTOR GIVES"
 9470 PRINT "IMFORMATION ABOUT THE CONTENTS"
 9480 PRINT "OF THAT SECTOR."
 9490 PRINT 
 9500 PRINT "THE IMFORMATON IS GIVEN AS:-"
 9510 PRINT 
 9520 PRINT "THE NO. OF","THE NO. OF"
 9525 PRINT "''''''''''''''''''''","''''''''''''''''''''"
 9530 PRINT "HUNDREDS    =   DRAKKONS."
 9540 PRINT "TENS        =   STARBASES"
 9550 PRINT "UNITS       =   STARS"
 9560 PRINT 
 9570 PRINT "TO PLAY PRESS NEWLINE."
 9580 INPUT A$
 9590 CLS 
 9600 RETURN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top