2 REM PRINT TAB(33);"ORBIT"
4 REM PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
6 PRINT:PRINT:PRINT
10 PRINT "SOMEWHERE ABOVE YOUR PLANET IS A ROMULAN SHIP."
15 PRINT
20 PRINT "THE SHIP IS IN A CONSTANT POLAR ORBIT.  ITS"
25 PRINT "DISTANCE FROM THE CENTER OF YOUR PLANET IS FROM"
30 PRINT "10,000 TO 30,000 MILES AND AT ITS PRESENT VELOCITY CAN"
31 PRINT "CIRCLE YOUR PLANET ONCE EVERY 12 TO 36 HOURS."
35 PRINT
40 PRINT "UNFORTUNATELY, THEY ARE USING A CLOAKING DEVICE SO"
45 PRINT "YOU ARE UNABLE TO SEE THEM, BUT WITH A SPECIAL"
50 PRINT "INSTRUMENT YOU CAN TELL HOW NEAR THEIR SHIP YOUR"
55 PRINT "PHOTON BOMB EXPLODED.  YOU HAVE SEVEN HOURS UNTIL THEY"
60 PRINT "HAVE BUILT UP SUFFICIENT POWER IN ORDER TO ESCAPE"
65 PRINT "YOUR PLANET'S GRAVITY."
70 PRINT
75 PRINT "YOUR PLANET HAS ENOUGH POWER TO FIRE ONE BOMB AN HOUR."
80 PRINT
85 PRINT "AT THE BEGINNING OF EACH HOUR YOU WILL BE ASKED TO GIVE AN"
90 PRINT "ANGLE (BETWEEN 0 AND 360) AND A DISTANCE IN UNITS OF"
95 PRINT "100 MILES (BETWEEN 100 AND 300), AFTER WHICH YOUR BOMB'S"
100 PRINT "DISTANCE FROM THE ENEMY SHIP WILL BE GIVEN."
105 PRINT
110 PRINT "AN EXPLOSION WITHIN 5,000 MILES OF THE ROMULAN SHIP"
111 PRINT "WILL DESTROY IT."
114 PRINT
115 PRINT "BELOW IS A DIAGRAM TO HELP YOU VISUALIZE YOUR PLIGHT."
116 PRINT
117 PRINT
168 PRINT "                          90"
170 PRINT "                    0000000000000"
171 PRINT "                 0000000000000000000"
172 PRINT "               000000           000000"
173 PRINT "             00000                 00000"
174 PRINT "            00000    XXXXXXXXXXX    00000"
175 PRINT "           00000    XXXXXXXXXXXXX    00000"
176 PRINT "          0000     XXXXXXXXXXXXXXX     0000"
177 PRINT "         0000     XXXXXXXXXXXXXXXXX     0000"
178 PRINT "        0000     XXXXXXXXXXXXXXXXXXX     0000"
179 PRINT "180<== 00000     XXXXXXXXXXXXXXXXXXX     00000 ==>0"
180 PRINT "        0000     XXXXXXXXXXXXXXXXXXX     0000"
181 PRINT "         0000     XXXXXXXXXXXXXXXXX     0000"
182 PRINT "          0000     XXXXXXXXXXXXXXX     0000"
183 PRINT "           00000    XXXXXXXXXXXXX    00000"
184 PRINT "            00000    XXXXXXXXXXX    00000"
185 PRINT "             00000                 00000"
186 PRINT "               000000           000000"
187 PRINT "                 0000000000000000000"
188 PRINT "                    0000000000000"
190 PRINT "                         270"
192 PRINT
195 PRINT "X - YOUR PLANET"
196 PRINT "O - THE ORBIT OF THE ROMULAN SHIP"
197 PRINT
198 PRINT "ON THE ABOVE DIAGRAM, THE ROMULAN SHIP IS CIRCLING"
199 PRINT "COUNTERCLOCKWISE AROUND YOUR PLANET.  DON'T FORGET THAT"
200 PRINT "WITHOUT SUFFICIENT POWER THE ROMULAN SHIP'S ALTITUDE"
210 PRINT "AND ORBITAL RATE WILL REMAIN CONSTANT."
220 PRINT 
230 PRINT "GOOD LUCK.  THE FEDERATION IS COUNTING ON YOU."
270 A=RND(360)
280 D=RND(200)+200
290 R=RND(20)+10
300 H=0
310 IF H=7 THEN GOTO 490
320 H=H+1
325 PRINT
326 PRINT
330 PRINT "THIS IS HOUR ";H;", AT WHAT ANGLE DO YOU WISH TO SEND"
335 PRINT "YOUR PHOTON BOMB";
340 INPUT F
350 PRINT "HOW FAR OUT DO YOU WISH TO DETONATE IT";
360 INPUT G
365 PRINT
366 PRINT
370 A=A+R
380 IF A<360 THEN GOTO 400
390 A=A-360
400 T=ABS(A-F)
410 IF T<180 THEN GOTO 430
420 T=360-T
430 PUSH (T*31415)/180 : GOSUB 9010 : PUSH (D*D+G*G)-((2*D*G*POP())/10000),1 :GOSUB 9030
440 PRINT "YOUR PHOTON BOMB EXPLODED ";TOS()/10;".";TOS()%10;
445 PRINT "*10^2 MILES FROM THE" : PRINT "ROMULAN SHIP."
450 IF POP()<501 THEN GOTO 470
460 GOTO 310
470 PRINT "YOU HAVE SUCCESFULLY COMPLETED YOUR MISSION."
480 GOTO 500
490 PRINT "YOU HAVE ALLOWED THE ROMULANS TO ESCAPE."
500 PRINT : PRINT "ANOTHER ROMULAN SHIP HAS GONE INTO ORBIT."
510 INPUT "DO YOU WISH TO TRY TO DESTROY IT (0 = no, 1 = yes) ";C
530 IF C=1 THEN GOTO 270
540 PRINT "GOOD BYE."
999 END
9010 LOCAL(1) : PUSH ABS(POP()%62832) : IF TOS()>31416 THEN PUSH 62832-POP()
     LET A@=TOS()>15708 : IF A@ THEN PUSH 31416-POP()
     PUSH TOS() : PUSH (POP()*POP())/10000 : PUSH 10000+((10000*-(TOS()/56))/10000)
     PUSH 10000+((POP()*-(TOS()/30))/10000): PUSH 10000+((POP()*-(TOS()/12))/10000)
     PUSH 10000+((POP()*-(POP()/2))/10000) : IF A@ THEN PUSH -POP()
     RETURN
     REM ** This is an integer COS subroutine. Input and output are scaled by 10K.
9030 LOCAL(1) : PUSH ((10^(POP()*2))*POP()) : A@=TOS()
9040 PUSH (A@ + (TOS()/A@))/2
     IF ABS(A@-TOS())<2 THEN A@=POP() : IF POP() THEN PUSH A@ : RETURN
     A@ = POP() : GOTO 9040
     REM ** This is an integer SQR subroutine. Output is scaled by 10^(TOS()).