mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-11-30 01:49:29 +00:00
284 lines
8.0 KiB
Plaintext
284 lines
8.0 KiB
Plaintext
100 REM ***********************
|
|
110 REM S.M.COMPTON.
|
|
120 REM BLACKHOLE.
|
|
130 REM 12-12-79.
|
|
140 REM ***********************
|
|
150 DIM EX(34),EY(34)
|
|
160 XOLD = 139:YOLD = 76
|
|
170 T1 = 0:T2 = 0
|
|
180 GOSUB 2570: REM NAME AND DATE PRINTER.
|
|
190 GOSUB 2300: REM INSTRUCTIONS.
|
|
200 GOSUB 280: REM CONSTRUCT SCREEN.
|
|
210 GOSUB 480: REM DRAW NEW BALL.
|
|
220 GOSUB 650: REM OBTAIN FIRE COORDINATES.
|
|
230 GOSUB 920: REM CHECK FOR HIT
|
|
240 IF HIT = 0 THEN 210: REM RESTART.
|
|
250 GOSUB 1650: REM CONSTRUCT EXPLOSION.
|
|
260 GOSUB 1910: REM TALLY SCORE.
|
|
270 GOTO 210: REM RESTART.
|
|
280 REM ***********************
|
|
290 REM CONSTRUCT SCREEN
|
|
300 REM ***********************
|
|
310 HGR
|
|
320 HCOLOR= 6
|
|
330 FOR I = 0 TO 278 STEP 2
|
|
340 HPLOT I,0 TO I,159
|
|
350 NEXT I
|
|
360 HCOLOR= 4
|
|
370 HPLOT 84,159 TO 96,159
|
|
380 HPLOT 86,158 TO 94,158
|
|
390 HPLOT 88,157 TO 92,157
|
|
400 HPLOT 182,159 TO 194,159
|
|
410 HPLOT 184,158 TO 192,158
|
|
420 HPLOT 186,157 TO 190,157
|
|
430 HOME
|
|
440 FOR I = 1 TO 21: PRINT : NEXT I
|
|
450 PRINT TAB( 10)"BATTERY 1"; TAB( 24)"BATTERY 2"
|
|
460 PRINT TAB( 13)T1, TAB( 27)T2
|
|
470 RETURN
|
|
480 REM ***********************
|
|
490 REM DRAW NEW BALL
|
|
500 REM ***********************
|
|
510 X = INT (139 * RND (1) + 1)
|
|
520 X = 2 * X - 1
|
|
530 Y = INT (156 * RND (1) + 1)
|
|
540 HCOLOR= 6
|
|
550 HPLOT XOLD - 1,YOLD - 1 TO XOLD - 1,YOLD + 1
|
|
560 HPLOT XOLD + 1,YOLD - 1 TO XOLD + 1,YOLD + 1
|
|
570 HCOLOR= 6
|
|
580 HPLOT XOLD - 1,YOLD - 1 TO XOLD - 1,YOLD + 1
|
|
590 HPLOT XOLD + 1,YOLD - 1 TO XOLD + 1,YOLD + 1
|
|
600 HCOLOR= 4
|
|
610 HPLOT X - 1,Y - 1 TO X - 1,Y + 1
|
|
620 HPLOT X + 1,Y - 1 TO X + 1,Y + 1
|
|
630 XOLD = X:YOLD = Y
|
|
640 RETURN
|
|
650 REM ***********************
|
|
660 REM OBTAIN FIRE COORDINATES
|
|
670 REM ***********************
|
|
680 FOR I = 1 TO 50
|
|
690 IF PEEK ( - 16287) > 127 THEN 740
|
|
700 IF PEEK ( - 16286) > 127 THEN 830
|
|
710 NEXT I
|
|
720 B1 = 0:B2 = 0
|
|
730 RETURN
|
|
740 B1 = 180 - PDL (0) / 1.417
|
|
750 IF B1 < 0 THEN B1 = 0
|
|
760 IF B1 > 180 THEN B1 = 180
|
|
770 B2 = 0
|
|
780 IF B1 < > 90 THEN 800
|
|
790 B1 = 89.9999
|
|
800 M = TAN (B1 / 180 * 3.14159)
|
|
810 B = 156 + M * 90
|
|
820 RETURN
|
|
830 B2 = 180 - PDL (1) / 1.417
|
|
840 IF B2 < 0 THEN B2 = 0
|
|
850 IF B2 > 180 THEN B2 = 180
|
|
860 B1 = 0
|
|
870 IF B2 < > 90 THEN 890
|
|
880 B2 = 89.9999
|
|
890 M = TAN (B2 / 180 * 3.14159)
|
|
900 B = 156 + M * 188
|
|
910 RETURN
|
|
920 REM ***********************
|
|
930 REM CHECK FOR HIT
|
|
940 REM ***********************
|
|
950 IF B1 < > 0 THEN 990
|
|
960 IF B2 < > 0 THEN 1320
|
|
970 HIT = 0
|
|
980 RETURN
|
|
990 HCOLOR= 5
|
|
1000 IF (( - M * (X + 4) + B) > Y) AND (( - M * (X - 4) + B) < Y) THEN 1250
|
|
1010 HIT = 0
|
|
1020 IF B1 > 39.5361906 THEN 1100
|
|
1030 XS = 279
|
|
1040 YS = INT ( - M * 279 + B)
|
|
1050 HPLOT 90,156 TO XS,YS
|
|
1060 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I
|
|
1070 HCOLOR= 6
|
|
1080 HPLOT 90,156 TO XS,YS
|
|
1090 RETURN
|
|
1100 IF B1 > 119.981589 THEN 1180
|
|
1110 YS = 0
|
|
1120 XS = INT (B / M)
|
|
1130 HPLOT 90,156 TO XS,YS
|
|
1140 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I
|
|
1150 HCOLOR= 6
|
|
1160 HPLOT 90,156 TO XS,YS
|
|
1170 RETURN
|
|
1180 XS = 0
|
|
1190 YS = INT (B)
|
|
1200 HPLOT 90,156 TO XS,YS
|
|
1210 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I
|
|
1220 HCOLOR= 6
|
|
1230 HPLOT 90,156 TO XS,YS
|
|
1240 RETURN
|
|
1250 HIT = 1
|
|
1260 HPLOT 90,156 TO X,Y
|
|
1270 FOR I = 1 TO 5:SB = PEEK ( - 16336): NEXT I
|
|
1280 HCOLOR= 6
|
|
1290 FOR I = 1 TO 10: NEXT I
|
|
1300 HPLOT 90,156 TO X,Y
|
|
1310 RETURN
|
|
1320 HCOLOR= 5
|
|
1330 IF (( - M * (X + 4) + B) > Y) AND (( - M * (X - 4) + B) < Y) THEN 1580
|
|
1340 HIT = 0
|
|
1350 IF B2 > 59.7436134 THEN 1430
|
|
1360 XS = 279
|
|
1370 YS = INT ( - M * 279 + B)
|
|
1380 HPLOT 188,156 TO XS,YS
|
|
1390 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I
|
|
1400 HCOLOR= 6
|
|
1410 HPLOT 188,156 TO XS,YS
|
|
1420 RETURN
|
|
1430 IF B2 > 140.314512 THEN 1510
|
|
1440 YS = 0
|
|
1450 XS = INT (B / M)
|
|
1460 HPLOT 188,156 TO XS,YS
|
|
1470 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I
|
|
1480 HCOLOR= 6
|
|
1490 HPLOT 188,156 TO XS,YS
|
|
1500 RETURN
|
|
1510 XS = 0
|
|
1520 YS = B
|
|
1530 HPLOT 188,156 TO XS,YS
|
|
1540 FOR I = 1 TO 10:SB = PEEK ( - 16336): NEXT I
|
|
1550 HCOLOR= 6
|
|
1560 HPLOT 188,156 TO XS,YS
|
|
1570 RETURN
|
|
1580 HIT = 1
|
|
1590 HPLOT 188,156 TO X,Y
|
|
1600 FOR I = 1 TO 5:SB = PEEK ( - 16336): NEXT I
|
|
1610 FOR I = 1 TO 10: NEXT I
|
|
1620 HCOLOR= 6
|
|
1630 HPLOT 188,156 TO X,Y
|
|
1640 RETURN
|
|
1650 REM **********************
|
|
1660 REM CONSTRUCT EXPLOSION
|
|
1670 REM **********************
|
|
1680 FOR I = 1 TO 10
|
|
1690 ES = PEEK ( - 16336) - PEEK ( - 16336)
|
|
1700 NEXT I
|
|
1710 HCOLOR= 6
|
|
1720 HPLOT X,Y
|
|
1730 HPLOT X + 1,Y - 1
|
|
1740 HCOLOR= 4
|
|
1750 FOR J = 4 TO 33
|
|
1760 RX = ( - 1) ^ INT (6 * RND (1) + 1)
|
|
1770 RY = ( - 1) ^ INT (6 * RND (1) + 1)
|
|
1780 XE = X + RX * INT (J / 2 * RND (1) + 1)
|
|
1790 YE = Y + RY * INT (J / 2 * RND (1) + 1)
|
|
1800 IF XE < 0 OR XE > 279 THEN 1780
|
|
1810 IF YE < 0 OR YE > 156 THEN 1790
|
|
1820 HPLOT XE,YE
|
|
1830 EX(J) = XE
|
|
1840 EY(J) = YE
|
|
1850 NEXT J
|
|
1860 HCOLOR= 6
|
|
1870 FOR J = 4 TO 33
|
|
1880 HPLOT EX(J),EY(J)
|
|
1890 NEXT J
|
|
1900 RETURN
|
|
1910 REM **********************
|
|
1920 REM TALLY SCORE.
|
|
1930 REM **********************
|
|
1940 IF B1 < > 0 THEN 2100
|
|
1950 T2 = T2 + 1
|
|
1960 IF T2 = 10 THEN 1990
|
|
1970 GOSUB 2250
|
|
1980 RETURN
|
|
1990 HOME
|
|
2000 FOR I = 1 TO 21: PRINT : NEXT I
|
|
2010 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2"
|
|
2020 PRINT TAB( 10)"** BATTERY 2 WINS !! **"
|
|
2030 FOR I = 1 TO 2000: NEXT I
|
|
2040 HOME
|
|
2050 FOR I = 1 TO 21: PRINT : NEXT I
|
|
2060 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2"
|
|
2070 T1 = 0:T2 = 0
|
|
2080 PRINT TAB( 13)T1 TAB( 27)T2
|
|
2090 RETURN
|
|
2100 T1 = T1 + 1
|
|
2110 IF T1 = 10 THEN 2140
|
|
2120 GOSUB 2250
|
|
2130 RETURN
|
|
2140 HOME
|
|
2150 FOR I = 1 TO 21: PRINT : NEXT I
|
|
2160 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2"
|
|
2170 PRINT TAB( 10)"** BATTERY 1 WINS !! **"
|
|
2180 FOR I = 1 TO 2000: NEXT I
|
|
2190 T1 = 0:T2 = 0
|
|
2200 HOME
|
|
2210 FOR I = 1 TO 21: PRINT : NEXT I
|
|
2220 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2"
|
|
2230 PRINT TAB( 13)T1 TAB( 27)T2
|
|
2240 RETURN
|
|
2250 HOME
|
|
2260 FOR I = 1 TO 21: PRINT : NEXT I
|
|
2270 PRINT TAB( 10)"BATTERY 1" TAB( 24)"BATTERY 2"
|
|
2280 PRINT TAB( 13)T1 TAB( 27)T2
|
|
2290 RETURN
|
|
2300 REM **********************
|
|
2310 REM INSTRUCTIONS
|
|
2320 REM **********************
|
|
2330 HOME
|
|
2340 PRINT TAB( 11)"** BLACKHOLE **"
|
|
2350 PRINT
|
|
2360 PRINT "BLACKHOLE IS A GAME FOR ONE OR TWO PLA-"
|
|
2370 PRINT "YERS USING THE PADDLES. PADDLE 0 IS "
|
|
2380 PRINT "ASSIGNED TO ARTILLARY BATTERY #1 AND"
|
|
2390 PRINT "PADDLE 1 IS ASSIGNED TO ARTILLARY BAT-"
|
|
2400 PRINT "TERY #2. EACH PADDLE CONTROLS THE ANGLE"
|
|
2410 PRINT "OF FIRE AS WELL AS THE FIRING OF A LAS-"
|
|
2420 PRINT "ER FROM ITS RESPECTIVE BATTERY. THE OB-"
|
|
2430 PRINT "JECT IS TO FIRE YOUR LASER THROUGH ONE"
|
|
2440 PRINT "OF THE BLACKHOLES THAT APPEAR AT RANDOM"
|
|
2450 PRINT "ABOVE THE BATTERIES."
|
|
2460 PRINT
|
|
2470 PRINT "RATHER THAN COMPETE FOR THE OPPORTUNITY"
|
|
2480 PRINT "TO FIRE YOUR LASER, IT IS RECOMMENDED"
|
|
2490 PRINT "THAT THE PLAYERS AGREE TO FIRE TEN"
|
|
2500 PRINT "ROUNDS APIECE IN SEQUENCE."
|
|
2510 PRINT
|
|
2520 PRINT "PRESS <CTRL-C> TO TERMINATE EXECUTION."
|
|
2530 PRINT
|
|
2540 PRINT "PRESS ANY KEY TO BEGIN."
|
|
2550 GET ZZ$
|
|
2560 RETURN
|
|
2570 REM **********************
|
|
2580 REM NAME AND DATE PRINTER
|
|
2590 REM **********************
|
|
2600 HOME
|
|
2610 FOR WZ = 1 TO 22
|
|
2620 IF (WZ = 1) OR (WZ = 22) THEN 2650
|
|
2630 PRINT "*" TAB( 40)"*";
|
|
2640 GOTO 2660
|
|
2650 FOR MZ = 1 TO 40: PRINT "*";: NEXT MZ
|
|
2660 NEXT WZ
|
|
2670 NZ$ = "S.M.COMPTON"
|
|
2680 DZ$ = "12-12-79"
|
|
2690 GZ$ = "BLACKHOLE"
|
|
2700 SZ = - 16336
|
|
2710 VTAB 9
|
|
2720 HTAB 15
|
|
2730 FOR WZ = 1 TO 11
|
|
2740 PRINT MID$ (NZ$,WZ,1);
|
|
2750 SOUND = PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ)
|
|
2760 FOR MZ = 1 TO 150: NEXT MZ
|
|
2770 NEXT WZ
|
|
2780 VTAB 11
|
|
2790 HTAB 16
|
|
2800 FOR WZ = 1 TO 8
|
|
2810 PRINT MID$ (DZ$,WZ,1);
|
|
2820 SOUND = PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ)
|
|
2830 FOR MZ = 1 TO 150: NEXT MZ
|
|
2840 NEXT WZ
|
|
2850 VTAB 13
|
|
2860 HTAB 16
|
|
2870 FOR WZ = 1 TO 9
|
|
2880 PRINT MID$ (GZ$,WZ,1);
|
|
2890 SOUND = PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ) + PEEK (SZ) - PEEK (SZ)
|
|
2900 FOR MZ = 1 TO 150: NEXT MZ
|
|
2910 NEXT WZ
|
|
2920 FOR WZ = 1 TO 500: NEXT WZ
|
|
2930 RETURN |