ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

282 lines
6.8 KiB

  1. 50 PRINT CHR$(26):WIDTH 80
  2. 100 PRINT TAB(33);"QUBIC":PRINT
  3. 110 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
  4. 120 PRINT:PRINT:PRINT
  5. 210 PRINT "DO YOU WANT INSTRUCTIONS";
  6. 220 INPUT C$
  7. 230 IF LEFT$(C$,1)="N" THEN 315
  8. 240 IF LEFT$(C$,1)="Y" THEN 265
  9. 250 PRINT "INCORRECT ANSWER. PLEASE TYPE 'YES' OR 'NO'";
  10. 260 GOTO 220
  11. 265 PRINT
  12. 270 PRINT "THE GAME IS TIC-TAC-TOE IN A 4 X 4 X 4 CUBE."
  13. 280 PRINT "EACH MOVE IS INDICATED BY A 3 DIGIT NUMBER, WITH EACH"
  14. 290 PRINT "DIGIT BETWEEN 1 AND 4 INCLUSIVE. THE DIGITS INDICATE THE"
  15. 300 PRINT "LEVEL, ROW, AND COLUMN, RESPECTIVELY, OF THE OCCUPIED"
  16. 305 PRINT "PLACE. "
  17. 306 PRINT
  18. 307 PRINT "TO PRINT THE PLAYING BOARD, TYPE 0 (ZERO) AS YOUR MOVE."
  19. 308 PRINT "THE PROGRAM WILL PRINT THE BOARD WITH YOUR MOVES INDI-"
  20. 309 PRINT "CATED WITH A (Y), THE MACHINE'S MOVES WITH AN (M), AND"
  21. 310 PRINT "UNUSED SQUARES WITH A ( ). OUTPUT IS ON PAPER."
  22. 311 PRINT
  23. 312 PRINT "TO STOP THE PROGRAM RUN, TYPE 1 AS YOUR MOVE."
  24. 313 PRINT:PRINT
  25. 315 DIM X(64),L(76),M(76,4),Y(16)
  26. 320 FOR I = 1 TO 16
  27. 330 READ Y(I)
  28. 340 NEXT I
  29. 350 FOR I=1 TO 76
  30. 360 FOR J = 1 TO 4
  31. 370 READ M(I,J)
  32. 380 NEXT J
  33. 390 NEXT I
  34. 400 FOR I = 1 TO 64
  35. 410 LET X (I) =0
  36. 420 NEXT I
  37. 430 LET Z=1
  38. 440 PRINT "DO YOU WANT TO MOVE FIRST";
  39. 450 INPUT S$
  40. 460 IF LEFT$(S$,1)="N" THEN 630
  41. 470 IF LEFT$(S$,1)="Y" THEN 500
  42. 480 PRINT "INCORRECT ANSWER. PLEASE TYPE 'YES' OR 'NO'.";
  43. 490 GOTO 450
  44. 500 PRINT " "
  45. 510 PRINT "YOUR MOVE";
  46. 520 INPUT J1
  47. 521 IF J1=1 THEN 2770
  48. 522 IF J1<>0 THEN 525
  49. 523 GOSUB 2550
  50. 524 GOTO 500
  51. 525 IF J1<111 THEN 2750
  52. 526 IF J1>444 THEN 2750
  53. 530 GOSUB 2500
  54. 540 LET K1=INT(J1/100)
  55. 550 LET J2=(J1-K1*100)
  56. 560 LET K2=INT(J2/10)
  57. 570 LET K3= J1 - K1*100 -K2*10
  58. 580 LET M=16*K1+4*K2+K3-20
  59. 590 IF X(M)=0 THEN 620
  60. 600 PRINT "THAT SQUARE IS USED, TRY AGAIN."
  61. 610 GOTO 500
  62. 620 LET X(M)=1
  63. 630 GOSUB 1640
  64. 640 J=1
  65. 650 I=1
  66. 660 IF J=1 THEN 720
  67. 670 IF J=2 THEN 790
  68. 680 IF J=3 THEN 930
  69. 690 I=I+1: IF I<=76 THEN 660
  70. 700 J=J+1: IF J<=3 THEN 650
  71. 710 GOTO 1300
  72. 720 IF L(I)<>4 THEN 690
  73. 730 PRINT "YOU WIN AS FOLLOWS";
  74. 740 FOR J=1 TO 4
  75. 750 LET M=M(I,J)
  76. 760 GOSUB 1570
  77. 770 NEXT J
  78. 780 GOTO 1490
  79. 790 IF L(I)<>15 THEN 690
  80. 800 FOR J=1 TO 4
  81. 810 LET M=M(I,J)
  82. 820 IF X(M)<>0 THEN 860
  83. 830 LET X(M)=5
  84. 840 PRINT "MACHINE MOVES TO";
  85. 850 GOSUB 1570
  86. 860 NEXT J
  87. 870 PRINT ", AND WINS AS FOLLOWS"
  88. 880 FOR J=1 TO 4
  89. 890 LET M=M(I,J)
  90. 900 GOSUB 1570
  91. 910 NEXT J
  92. 920 GOTO 1490
  93. 930 IF L(I)<>3 THEN 690
  94. 940 PRINT "NICE TRY. MACHINE MOVES TO";
  95. 950 FOR J=1 TO 4
  96. 960 LET M=M(I,J)
  97. 970 IF X(M)<>0 THEN 1010
  98. 980 LET X(M)=5
  99. 990 GOSUB 1570
  100. 1000 GOTO 500
  101. 1010 NEXT J
  102. 1020 GOTO 1300
  103. 1030 I=1
  104. 1040 LET L(I)=X(M(I,1))+X(M(I,2))+X(M(I,3))+X(M(I,4))
  105. 1050 LET L = L(I)
  106. 1060 IF L <2 THEN 1130
  107. 1070 IF L>=3 THEN 1130
  108. 1080 IF L>2 THEN 2230
  109. 1090 FOR J = 1 TO 4
  110. 1100 IF X(M(I,J))<>0 THEN 1120
  111. 1110 LET X(M(I,J))=1/8
  112. 1120 NEXT J
  113. 1130 I=I+1: IF I<=76 THEN 1040
  114. 1140 GOSUB 1640
  115. 1150 I=1
  116. 1160 IF L(I)=1/2 THEN 2360
  117. 1170 IF L(I)=1+3/8 THEN 2360
  118. 1180 I=I+1: IF I<=76 THEN 1160
  119. 1190 GOTO 1830
  120. 1200 LET Z = 1
  121. 1210 IF X(Y(Z))=0 THEN 1250
  122. 1220 LET Z=Z+1
  123. 1230 IF Z<>17 THEN 1210
  124. 1240 GOTO 1720
  125. 1250 LET M=Y(Z)
  126. 1260 LET X(M)=5
  127. 1270 PRINT "MACHINE MOVES TO";
  128. 1280 GOSUB 1570
  129. 1290 GOTO 500
  130. 1300 LET X=X
  131. 1310 I=1
  132. 1320 LET L(I)=X(M(I,1))+X(M(I,2))+X(M(I,3))+X(M(I,4))
  133. 1330 LET L=L(I)
  134. 1340 IF L<10 THEN 1410
  135. 1350 IF L>=11 THEN 1410
  136. 1360 IF L>10 THEN 2230
  137. 1370 FOR J=1 TO 4
  138. 1380 IF X(M(I,J))<>0 THEN 1400
  139. 1390 LET X(M(I,J))=1/8
  140. 1400 NEXT J
  141. 1410 I=I+1: IF I<=76 THEN 1320
  142. 1420 GOSUB 1640
  143. 1430 I=1
  144. 1440 IF L(I)=.5 THEN 2360
  145. 1450 IF L(I)=5+3/8 THEN 2360
  146. 1460 I=I+1: IF I<=76 THEN 1440
  147. 1470 GOSUB 2500
  148. 1480 GOTO 1030
  149. 1490 PRINT " "
  150. 1500 PRINT "DO YOU WANT TO TRY ANOTHER GAME";
  151. 1510 INPUT X$
  152. 1520 IF LEFT$(X$,1)="Y" THEN 400
  153. 1530 IF LEFT$(X$,1)="N" THEN 1560
  154. 1540 PRINT "INCORRECT ANSWER. PLEASE TYPE 'YES' OR 'NO'";
  155. 1550 GOTO 1510
  156. 1560 STOP
  157. 1570 LET K1=INT((M-1)/16)+1
  158. 1580 LET J2=M-16*(K1-1)
  159. 1590 LET K2=INT((J2-1)/4)+1
  160. 1600 LET K3=M-(K1-1)*16-(K2-1)*4
  161. 1610 LET M=K1*100+K2*10+K3
  162. 1620 PRINT M;
  163. 1630 RETURN
  164. 1640 FOR S=1 TO 76
  165. 1650 LET J1 = M(S,1)
  166. 1660 LET J2=M(S,2)
  167. 1670 LET J3=M(S,3)
  168. 1680 LET J4=M(S,4)
  169. 1690 LET L(S)=X(J1)+X(J2)+X(J3)+X(J4)
  170. 1700 NEXT S
  171. 1710 RETURN
  172. 1720 FOR I=1 TO 64
  173. 1730 IF X(I)<>0 THEN 1800
  174. 1740 LET X(I)=5
  175. 1750 LET M=I
  176. 1760 PRINT "MACHINE LIKES";
  177. 1770 GOSUB 1570
  178. 1780 PRINT " "
  179. 1790 GOTO 500
  180. 1800 NEXT I
  181. 1810 PRINT "THE GAME IS A DRAW."
  182. 1820 GOTO 1490
  183. 1830 FOR K=1 TO 18
  184. 1840 LET P=0
  185. 1850 FOR I=4*K-3 TO 4*K
  186. 1860 FOR J=1 TO 4
  187. 1870 LET P=P+X(M(I,J))
  188. 1880 NEXT J
  189. 1890 NEXT I
  190. 1900 IF P<4 THEN 1940
  191. 1910 IF P<5 THEN 1970
  192. 1920 IF P<9 THEN 1940
  193. 1930 IF P<10 THEN 1970
  194. 1940 NEXT K
  195. 1950 GOSUB 2500
  196. 1960 GOTO 1200
  197. 1970 LET S=1/8
  198. 1980 FOR I=4*K-3 TO 4*K
  199. 1990 GOTO 2370
  200. 2000 NEXT I
  201. 2010 LET S=0
  202. 2020 GOTO 1980
  203. 2030 DATA 1,49,52,4,13,61,64,16,22,39,23,38,26,42,27,43
  204. 2040 DATA 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
  205. 2050 DATA 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38
  206. 2060 DATA 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56
  207. 2070 DATA 57,58,59,60,61,62,63,64
  208. 2080 DATA 1,17,33,49,5,21,37,53,9,25,41,57,13,29,45,61
  209. 2090 DATA 2,18,34,50,6,22,38,54,10,26,42,58,14,30,46,62
  210. 2100 DATA 3,19,35,51,7,23,39,55,11,27,43,59,15,31,47,63
  211. 2110 DATA 4,20,36,52,8,24,40,56,12,28,44,60,16,32,48,64
  212. 2120 DATA 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61
  213. 2130 DATA 2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62
  214. 2140 DATA 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63
  215. 2150 DATA 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64
  216. 2160 DATA 1,6,11,16,17,22,27,32,33,38,43,48,49,54,59,64
  217. 2170 DATA 13,10,7,4,29,26,23,20,45,42,39,36,61,58,55,52
  218. 2180 DATA 1,21,41,61,2,22,42,62,3,23,43,63,4,24,44,64
  219. 2190 DATA 49,37,25,13,50,38,26,14,51,39,27,15,52,40,28,16
  220. 2200 DATA 1,18,35,52,5,22,39,56,9,26,43,60,13,30,47,64
  221. 2210 DATA 49,34,19,4,53,38,23,8,57,42,27,12,61,46,31,16
  222. 2220 DATA 1,22,43,64,16,27,38,49,4,23,42,61,13,26,39,52
  223. 2230 FOR J=1 TO 4
  224. 2240 IF X(M(I,J))<>1/8 THEN 2330
  225. 2250 LET X(M(I,J))=5
  226. 2260 IF L(I)<5 THEN 2290
  227. 2270 PRINT "LET'S SEE YOU GET OUT OF THIS: MACHINE MOVES TO";
  228. 2280 GOTO 2300
  229. 2290 PRINT "YOU FOX. JUST IN THE NICK OF TIME, MACHINE MOVES TO";
  230. 2300 LET M=M(I,J)
  231. 2310 GOSUB 1570
  232. 2320 GOTO 500
  233. 2330 NEXT J
  234. 2340 PRINT "MACHINE CONCEDES THIS GAME."
  235. 2350 GOTO 1490
  236. 2360 LET S=1/8
  237. 2370 IF I-INT(I/4)*4>1 THEN 2400
  238. 2380 LET A=1
  239. 2390 GOTO 2410
  240. 2400 LET A=2
  241. 2410 FOR J=A TO 5-A STEP 5-2*A
  242. 2420 IF X(M(I,J))=S THEN 2450
  243. 2430 NEXT J
  244. 2440 GOTO 2000
  245. 2450 LET X(M(I,J))=5
  246. 2460 LET M=M(I,J)
  247. 2470 PRINT "MACHINE TAKES";
  248. 2480 GOSUB 1570
  249. 2490 GOTO 500
  250. 2500 FOR I=1 TO 64
  251. 2510 IF X(I)<>1/8 THEN 2530
  252. 2520 LET X(I)=0
  253. 2530 NEXT I
  254. 2540 RETURN
  255. 2550 FOR XX=1 TO 9:PRINT:NEXT:FOR I=1 TO 4
  256. 2560 FOR J=1 TO 4
  257. 2562 FOR I1=1 TO J
  258. 2564 PRINT" ";
  259. 2566 NEXT I1
  260. 2570 FOR K=1 TO 4
  261. 2600 LET Q=16*I+4*J+K-20
  262. 2610 IF X(Q)<>O THEN 2630
  263. 2620 PRINT"( ) ";
  264. 2630 IF X(Q)<>5 THEN 2650
  265. 2640 PRINT"(M) ";
  266. 2650 IF X(Q)<>1 THEN 2660
  267. 2655 PRINT"(Y) ";
  268. 2660 IF X(Q)<>1/8 THEN 2670
  269. 2665 PRINT"( ) ";
  270. 2670 NEXT K
  271. 2680 PRINT
  272. 2690 PRINT
  273. 2700 NEXT J
  274. 2710 PRINT
  275. 2720 PRINT
  276. 2730 NEXT I
  277. 2735 REM PRINT CHR$(12)
  278. 2740 RETURN
  279. 2750 PRINT"INCORRECT MOVE, RETYPE IT--";
  280. 2760 GOTO 520
  281. 2770 END