1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-11-18 02:17:00 -05:00

Add BOWL, DIGITS and LIFE-2.

This commit is contained in:
Renaud 2024-05-18 13:31:34 +08:00
parent f2a40617c5
commit 27dbf1a58e
6 changed files with 513 additions and 0 deletions

100
dec/BOWL.BAS Normal file
View File

@ -0,0 +1,100 @@
90 REMARK AND ORIGINAL IDEA AND PROGRAMED BY PAUL PERAINO
180 REMARK FROM WOODROW WILSON HIGH SCHOOL
270 DIM C(15),A(100,6)
360 PRINT "WELCOME TO THE ALLEY"
450 PRINT "BRING YOUR FRIENDS"
540 PRINT "OKAY LET'S FIRST GET ACQUAINTED"
630 PRINT\PRINT\PRINT
720 PRINT "WANT INSTRUCTIONS (Y OR N)";
810 INPUT Z$
900 IF Z$="Y" THEN 990
960 IF Z$="N" THEN 1530
990 PRINT "THE GAME OF BOWLING TAKES MIND AND SKILL.DURING THE GAME"
1080 PRINT "THE COMPUTER WILL KEEP SCORE.YOU MAY COMPETE WITH"
1170 PRINT "OTHER PLAYERS[UP TO FOUR].YOU WILL BE PLAYING TEN FRAMES"
1260 PRINT "ON THE PIN DIAGRAM 'O' MEANS THE PIN IS DOWN...'+' MEANS THE"
1350 PRINT "PIN IS STANDING.AFTER THE GAME THE COMPUTER WILL SHOW YOUR"
1440 PRINT "SCORES ."
1530 PRINT "FIRST OF ALL...HOW MANY ARE PLAYING";
1620 INPUT R
1710 PRINT
1800 PRINT "VERY GOOD..."
1890 MAT A=ZER
1980 F=1
2070 FOR P=1 TO R
2160 M=0
2250 B=1
2340 M=0\Q=0
2430 MAT C=ZER
2520 REMARK BALL GENERATOR USING MOD '15' SYSTEM
2610 PRINT "PLAYER"P" -- TYPE ROLL"
2700 INPUT N$
2790 K=0\D=0
2880 FOR I=1 TO 20
2970 X=INT(RND(I)*100)
3060 FOR J=1 TO 10
3150 IF X<15*J THEN 3330
3240 NEXT J
3330 C(15*J-X)=1
3420 NEXT I
3510 REMARK PIN DIAGRAM
3600 PRINT "PLAYER:"P" FRAME:"F" BALL:"B
3690 FOR I=0 TO 3
3780 PRINT
3870 FOR J=1 TO 4-I
3960 K=K+1
4050 IF C(K)=1 THEN 4320
4140 PRINT TAB(I);"+ ";
4230 GOTO 4410
4320 PRINT TAB(I);"O ";
4410 NEXT J
4500 NEXT I
4590 PRINT\PRINT\PRINT
4680 REMARK ROLL ANALYSIS
4770 FOR I=1 TO 10
4860 D=D+C(I)
4950 NEXT I
5040 IF D-M <> 0 THEN 5220
5130 PRINT "GUTTER!!"
5220 IF NOT(B=1 AND D=10) THEN 5490
5310 PRINT "STRIKE!!!!!"
5400 Q=3
5490 IF NOT(B=2 AND D=10) THEN 5760
5580 PRINT "SPARE!!!!"
5670 Q=2
5760 IF NOT(B=2 AND D<10) THEN 6030
5850 PRINT "ERROR!!!"
5940 Q=1
6030 IF NOT(B=1 AND D<10) THEN 6210
6120 PRINT "ROLL YOUR 2ND BALL"
6210 REMARK STORAGE OF THE SCORES
6300 PRINT
6390 A(F*P,B)=D
6480 IF B=2 THEN 7020
6570 B=2
6660 M=D
6750 IF Q=3 THEN 6210
6840 A(F*P,3)=D-M
6930 IF Q=0 THEN 2520
7020 A(F*P,3)=Q
7110 NEXT P
7200 F=F+1
7290 IF F<11 THEN 2070
7295 PRINT "FRAMES"
7380 FOR I=1 TO 10
7470 PRINT I;
7560 NEXT I
7650 PRINT
7740 FOR P=1 TO R
7830 FOR I=1 TO 3
7920 FOR J=1 TO 10
8010 PRINT A(J,I);
8100 NEXT J
8105 PRINT
8190 NEXT I
8280 PRINT
8370 NEXT P
8460 PRINT "DO YOU WANT ANOTHER GAME"
8550 INPUT A$
8640 IF A$="Y" THEN 2610
8730 END

75
dec/DIGITS.BAS Normal file
View File

@ -0,0 +1,75 @@
210 PRINT "THIS IS A GAME OF GUESSING."
220 PRINT "FOR INSTRUCTIONS, TYPE '1', ELSE TYPE '0'";
230 INPUT E
240 IF E=0 THEN 360
250 PRINT
260 PRINT "PLEASE TAKE A PIECE OF PAPER AND WRITE DOWN"
270 PRINT "THE DIGITS '0', '1', OR '2' THIRTY TIMES AT RANDOM."
280 PRINT "ARRANGE THEM IN THREE LINES OF TEN DIGITS."
290 PRINT "I WILL ASK FOR THEM 10 AT A TIME."
300 PRINT "I WILL ALWAYS GUESS FIRST, AND THEN LOOK AT YOUR"
310 PRINT "NEXT NUMBER TO SEE IF I WAS RIGHT. BY PURE LUCK I"
320 PRINT "OUGHT TO BE RIGHT 10 TIMES. BUT I HOPE TO DO BETTER"
330 PRINT "THAN THAT ****"
340 PRINT\PRINT
360 READ A,B,C
370 DATA 0,1,3
380 DIM M(26,2) ,K(2,2), L(8,2)
400 MAT M=CON\MAT K=CON
420 MAT K=(9)*K\MAT L=CON
440 MAT L=(3)*L
450 L(0,0)=2\L(4,1)=2\L(8,2)=2
480 Z=26\Z1=8\Z2=2
510 X=0
520 FOR T=1 TO 3
530 PRINT
540 PRINT "TEN NUMBERS PLEASE";
550 INPUT N(1),N(2),N(3),N(4),N(5),N(6),N(7),N(8),N(9),N(10)
560 FOR I=1 TO 10
570 W=N(I)-1
580 IF W=SGN(W) THEN 620
590 PRINT "USE ONLY THE DIGITS '0', '1', OR '2'."
600 PRINT "LET'S TRY AGAIN."\GOTO 530
620 NEXT I
630 PRINT\PRINT "MY GUESS","YOUR NO.","RESULT","NO. RIGHT"\PRINT
660 FOR U=1 TO 10
670 N=N(U)\S=0
690 FOR J=0 TO 2
700 S1=A*K(Z2,J)+B*L(Z1,J)+C*M(Z,J)
710 IF S>S1 THEN 760
720 IF S<S1 THEN 740
730 IF RND<.5 THEN 760
740 S=S1\G=J
760 NEXT J
770 PRINT G,N(U),
780 IF G=N(U) THEN 810
790 PRINT "WRONG",X
800 GOTO 880
810 X=X+1
820 PRINT "RIGHT",X
830 M(Z,N)=M(Z,N)+1
840 L(Z1,N)=L(Z1,N)+1
850 K(Z2,N)=K(Z2,N)+1
860 Z=Z-INT(Z/9)*9
870 Z=3*Z+N(U)
880 Z1=Z-INT(Z/9)*9
890 Z2=N(U)
900 NEXT U
910 NEXT T
920 PRINT
930 IF X>10 THEN 980
940 IF X<10 THEN 1010
950 PRINT "I GUESSED EXACTLY 1/3 OF YOUR NUMBERS."
960 PRINT "IT IS A TIE GAME."
970 GOTO 1030
980 PRINT "I GUESSED MORE THAN 1/3 OF YOUR NUMBERS."
990 PRINT "I WIN."\FOR Q=1 TO 10\PRINT CHR$(7);\NEXT Q
1000 GOTO 1030
1010 PRINT "I GUESSED LESS THAN 1/3 OF YOUR NUMBERS."
1020 PRINT "YOU BEAT ME. CONGRATULATIONS ****"
1030 PRINT
1040 PRINT "DO YOU WANT TO TRY AGAIN (1 FOR YES, 0 FOR NO)";
1060 INPUT X
1070 IF X=1 THEN 400
1080 PRINT\PRINT "THANKS FOR THE GAME."
1090 END

79
dec/LIFE-2.BAS Normal file
View File

@ -0,0 +1,79 @@
1 DIMN1(6,6),K1(18),A1(16),X(2),Y(2)
3 DATA 3,102,103,120,130,121,112,111,12
4 DATA 21,30,1020,1030,1011,1021,1003,1002,1012
10 FORM=1TO18:READK1(M):NEXTM
13 DATA-1,0,1,0,0,-1,0,1,-1,-1,1,-1,-1,1,1,1
14 FORO1=1TO16:READA1(O1):NEXTO1
20 GOTO500
50 FORJ=1TO5
51 FORK=1TO5
55 IFN1(J,K)>99THENGOSUB200
60 NEXTK
65 NEXTJ
90 LETK=0:LETM2=0:LETM3=0
99 FORJ=0TO6:PRINT
100 FORK=0TO6
101 IFJ<>0THENIFJ<>6THEN105
102 IFK=6THENPRINT0;:GOTO125
103 PRINTK;:GOTO120
105 IFK<>0THENIFK<>6THEN110
106 IFJ=6THENPRINT0:GOTO126
107 PRINTJ;:GOTO120
110 GOSUB300
120 NEXTK
125 NEXTJ
126 RETURN
200 LETB=1:IFN1(J,K)>999THENLETB=10
220 FORO1=1TO15STEP2
230 LETN1(J+A1(O1),K+A1(O1+1))=N1(J+A1(O1),K+A1(O1+1))+B
231 NEXTO1
239 RETURN
300 IFN1(J,K)<3THEN399
305 FORO1=1TO18
310 IFN1(J,K)=K1(O1)THEN350
315 NEXTO1
320 GOTO399
350 IFO1>9THEN360
351 LETN1(J,K)=100:LETM2=M2+1:PRINT" * ";
355 RETURN
360 LETN1(J,K)=1000:LETM3=M3+1:PRINT" # ";
365 RETURN
399 LETN1(J,K)=0:PRINT" ";:RETURN
500 PRINTTAB(10);"U.B LIFE GAME"
505 LETM2=0:LETM3=0
510 FORJ=1TO5
511 FORK=1TO5
515 LETN1(J,K)=0
516 NEXTK
517 NEXTJ
519 FORB=1TO2:LETP1=3:IFB=2THENLETP1=30
520 PRINT"PLAYER";B;"3 LIVE PIECES"
535 FORK1=1TO3:GOSUB700
540 LETN1(X(B),Y(B))=P1:NEXTK1
542 NEXTB
559 GOSUB90
560 PRINT:GOSUB50
570 IFM2=0THENIFM3=0THEN574
571 IFM3=0THENLETB=1:GOTO575
572 IFM2=0THENLETB=2:GOTO575
573 GOTO580
574 PRINT:PRINT"A DRAW":RUN
575 PRINT:PRINT"PLAYER";B;"IS THE WINNER":RUN
580 FORB=1TO2:PRINT:PRINT"PLAYER";B;:GOSUB700
581 IFB=99THEN560
582 NEXTB
586 LETN1(X(1),Y(1))=100:LETN1(X(2),Y(2))=1000
596 GOTO 560
700 PRINT"X,Y":PRINT"XXXX";CHR$(13);"@@@@";CHR$(13):INPUTY(B),X(B)
705 IFX(B)<=5THENIFX(B)>0THEN708
706 GOTO750
708 IFY(B)<=5THENIFY(B)>0THEN 715
710 GOTO750
715 IFN1(X(B),Y(B))<>0THEN750
720 IFB=1THENRETURN
725 IFX(1)=X(2)THENIFY(1)=Y(2)THEN 740
730 RETURN
740 PRINT "SAME COORD. SET TO 0"
741 LETN1(X(B)+1,Y(B)+1)=0:LETB=99:RETURN
750 PRINT"ILLEGAL COORDS. RETYPE":GOTO700
999 END

104
port/BOWL.BAS Normal file
View File

@ -0,0 +1,104 @@
9 REMARK AND ORIGINAL IDEA AND PROGRAMED BY PAUL PERAINO
18 REMARK FROM WOODROW WILSON HIGH SCHOOL
20 RANDOMIZE
27 DIM C(15),A(40,3)
36 PRINT "WELCOME TO THE ALLEY"
45 PRINT "BRING YOUR FRIENDS"
54 PRINT "OKAY LET'S FIRST GET ACQUAINTED"
63 PRINT\PRINT\PRINT
72 PRINT "WANT INSTRUCTIONS (Y OR N)";
81 INPUT Z$
90 IF Z$="Y" THEN 99
96 IF Z$="N" THEN 153
99 PRINT "THE GAME OF BOWLING TAKES MIND AND SKILL.DURING THE GAME"
108 PRINT "THE COMPUTER WILL KEEP SCORE.YOU MAY COMPETE WITH"
117 PRINT "OTHER PLAYERS[UP TO FOUR].YOU WILL BE PLAYING TEN FRAMES"
126 PRINT "ON THE PIN DIAGRAM 'O' MEANS THE PIN IS DOWN...'+' MEANS THE"
135 PRINT "PIN IS STANDING.AFTER THE GAME THE COMPUTER WILL SHOW YOUR"
144 PRINT "SCORES ."
153 PRINT "FIRST OF ALL...HOW MANY ARE PLAYING (1-4)";
162 INPUT R
165 IF R<1 THEN 153\IF R>4 THEN 153
171 PRINT
180 PRINT "VERY GOOD..."
198 F=1
207 FOR P=1 TO R
216 M=0
225 B=1
234 Q=0
243 FOR I=1 TO 10\C(I)=0\NEXT I
252 REMARK BALL GENERATOR USING MOD '15' SYSTEM
261 PRINT "PLAYER"P" -- TYPE ROLL"
270 INPUT N$
279 K=0\D=0
288 FOR I=1 TO 20
297 X=INT(RND(I)*100)
306 FOR J=1 TO 7
315 IF X<15*J THEN 333
324 NEXT J
333 C(15*J-X)=1
342 NEXT I
351 REMARK PIN DIAGRAM
360 PRINT "PLAYER:"P" FRAME:"F" BALL:"B
369 FOR I=0 TO 3
378 PRINT
379 PRINT TAB(I);
387 FOR J=1 TO 4-I
396 K=K+1
405 IF C(K)=1 THEN 432
414 PRINT "+ ";
423 GOTO 441
432 PRINT "O ";
441 NEXT J
450 NEXT I
459 PRINT\PRINT\PRINT
468 REMARK ROLL ANALYSIS
477 FOR I=1 TO 10
486 D=D+C(I)
495 NEXT I
504 IF D-M <> 0 THEN 522
513 PRINT "GUTTER!!"
522 IF B<>1 THEN 549\IF D<>10 THEN 549
531 PRINT "STRIKE!!!!!"
540 Q=3
549 IF B<>2 THEN 576\IF D<>10 THEN 576
558 PRINT "SPARE!!!!"
567 Q=2
576 IF B<>2 THEN 603\IF D>=10 THEN 603
585 PRINT "ERROR!!!"
594 Q=1
603 IF B<>1 THEN 621\IF D>=10 THEN 621
612 PRINT "ROLL YOUR 2ND BALL"
621 REMARK STORAGE OF THE SCORES
630 PRINT
639 A(F+(P-1)*10,B)=D
648 IF B=2 THEN 702
657 B=2
666 M=D
675 IF Q=3 THEN 621
684 A(F+(P-1)*10,3)=D-M
693 IF Q=0 THEN 252
702 A(F+(P-1)*10,3)=Q
711 NEXT P
720 F=F+1
729 IF F<11 THEN 207
730 PRINT "FRAMES"
738 FOR I=1 TO 10
747 PRINT " "I;
756 NEXT I
765 PRINT
774 FOR P=1 TO R
783 FOR I=1 TO 3
792 FOR J=1 TO 10
801 V=A(J+(P-1)*10,I)
803 IF V>=10 THEN 805\PRINT " ";
805 PRINT V;
810 NEXT J
815 PRINT
819 NEXT I
828 PRINT
837 NEXT P
846 PRINT "DO YOU WANT ANOTHER GAME"
855 INPUT A$
864 IF A$="Y" THEN 153
873 END

76
port/DIGITS.BAS Normal file
View File

@ -0,0 +1,76 @@
200 RANDOMIZE
210 PRINT "THIS IS A GAME OF GUESSING."
220 PRINT "FOR INSTRUCTIONS, TYPE '1', ELSE TYPE '0'";
230 INPUT E
240 IF E=0 THEN 360
250 PRINT
260 PRINT "PLEASE TAKE A PIECE OF PAPER AND WRITE DOWN"
270 PRINT "THE DIGITS '0', '1', OR '2' THIRTY TIMES AT RANDOM."
280 PRINT "ARRANGE THEM IN THREE LINES OF TEN DIGITS."
290 PRINT "I WILL ASK FOR THEM 10 AT A TIME."
300 PRINT "I WILL ALWAYS GUESS FIRST, AND THEN LOOK AT YOUR"
310 PRINT "NEXT NUMBER TO SEE IF I WAS RIGHT. BY PURE LUCK I"
320 PRINT "OUGHT TO BE RIGHT 10 TIMES. BUT I HOPE TO DO BETTER"
330 PRINT "THAN THAT ****"
340 PRINT\PRINT
360 READ A,B,C
370 DATA 0,1,3
380 DIM N(10), M(26,2) ,K(2,2), L(8,2)
400 FOR I=0 TO 26\FOR J=0 TO 2\M(I,J)=1\NEXT J\NEXT I
410 FOR I=0 TO 2\FOR J=0 TO 2\K(I,J)=9\NEXT J\NEXT I
420 FOR I=0 TO 8\FOR J=0 TO 2\L(I,J)=3\NEXT J\NEXT I
450 L(0,0)=2\L(4,1)=2\L(8,2)=2
480 Z=26\Z1=8\Z2=2
510 X=0
520 FOR T=1 TO 3
530 PRINT
540 PRINT "TEN NUMBERS PLEASE";
550 INPUT N(1),N(2),N(3),N(4),N(5),N(6),N(7),N(8),N(9),N(10)
560 FOR I=1 TO 10
570 W=N(I)-1
580 IF W=SGN(W) THEN 620
590 PRINT "USE ONLY THE DIGITS '0', '1', OR '2'."
600 PRINT "LET'S TRY AGAIN."\GOTO 530
620 NEXT I
630 PRINT\PRINT "MY GUESS","YOUR NO.","RESULT","NO. RIGHT"\PRINT
660 FOR U=1 TO 10
670 N=N(U)\S=0
690 FOR J=0 TO 2
700 S1=A*K(Z2,J)+B*L(Z1,J)+C*M(Z,J)
710 IF S>S1 THEN 760
720 IF S<S1 THEN 740
730 IF RND(1)<.5 THEN 760
740 S=S1\G=J
760 NEXT J
770 PRINT G,N(U),
780 IF G=N(U) THEN 810
790 PRINT "WRONG",X
800 GOTO 880
810 X=X+1
820 PRINT "RIGHT",X
830 M(Z,N)=M(Z,N)+1
840 L(Z1,N)=L(Z1,N)+1
850 K(Z2,N)=K(Z2,N)+1
860 Z=Z-INT(Z/9)*9
870 Z=3*Z+N(U)
880 Z1=Z-INT(Z/9)*9
890 Z2=N(U)
900 NEXT U
910 NEXT T
920 PRINT
930 IF X>10 THEN 980
940 IF X<10 THEN 1010
950 PRINT "I GUESSED EXACTLY 1/3 OF YOUR NUMBERS."
960 PRINT "IT IS A TIE GAME."
970 GOTO 1030
980 PRINT "I GUESSED MORE THAN 1/3 OF YOUR NUMBERS."
990 PRINT "I WIN."\FOR Q=1 TO 10\PRINT CHR$(7);\NEXT Q
1000 GOTO 1030
1010 PRINT "I GUESSED LESS THAN 1/3 OF YOUR NUMBERS."
1020 PRINT "YOU BEAT ME. CONGRATULATIONS ****"
1030 PRINT
1040 PRINT "DO YOU WANT TO TRY AGAIN (1 FOR YES, 0 FOR NO)";
1060 INPUT X
1070 IF X=1 THEN 400
1080 PRINT\PRINT "THANKS FOR THE GAME."
1090 END

79
port/LIFE-2.BAS Normal file
View File

@ -0,0 +1,79 @@
1 DIMN1(6,6),K1(18),A1(16),X(2),Y(2)
3 DATA 3,102,103,120,130,121,112,111,12
4 DATA 21,30,1020,1030,1011,1021,1003,1002,1012
10 FORM=1TO18\READK1(M)\NEXTM
13 DATA-1,0,1,0,0,-1,0,1,-1,-1,1,-1,-1,1,1,1
14 FORO1=1TO16\READA1(O1)\NEXTO1
20 GOTO500
50 FORJ=1TO5
51 FORK=1TO5
55 IFN1(J,K)<=99THEN60\GOSUB200
60 NEXTK
65 NEXTJ
90 LETK=0\LETM2=0\LETM3=0
99 FORJ=0TO6\PRINT
100 FORK=0TO6
101 IFJ=0THEN102\IFJ<>6THEN105
102 IFK<>6THEN103\PRINT0;\GOTO125
103 PRINTK;\GOTO120
105 IFK=0THEN106\IFK<>6THEN110
106 IFJ<>6THEN107\PRINT0\GOTO126
107 PRINTJ;\GOTO120
110 GOSUB300
120 NEXTK
125 NEXTJ
126 RETURN
200 LETB=1\IFN1(J,K)<=999THEN220\LETB=10
220 FORO1=1TO15STEP2
230 LETN1(J+A1(O1),K+A1(O1+1))=N1(J+A1(O1),K+A1(O1+1))+B
231 NEXTO1
239 RETURN
300 IFN1(J,K)<3THEN399
305 FORO1=1TO18
310 IFN1(J,K)=K1(O1)THEN350
315 NEXTO1
320 GOTO399
350 IFO1>9THEN360
351 LETN1(J,K)=100\LETM2=M2+1\PRINT" * ";
355 RETURN
360 LETN1(J,K)=1000\LETM3=M3+1\PRINT" # ";
365 RETURN
399 LETN1(J,K)=0\PRINT" ";\RETURN
500 PRINTTAB(10);"U.B LIFE GAME"
505 LETM2=0\LETM3=0
510 FORJ=1TO5
511 FORK=1TO5
515 LETN1(J,K)=0
516 NEXTK
517 NEXTJ
519 FORB=1TO2\LETP1=3\IFB<>2THEN520\LETP1=30
520 PRINT"PLAYER";B;"3 LIVE PIECES"
535 FORK1=1TO3\GOSUB700
540 LETN1(X(B),Y(B))=P1\NEXTK1
542 NEXTB
559 GOSUB90
560 PRINT\GOSUB50
570 IFM2<>0THEN571\IFM3=0THEN574
571 IFM3<>0THEN572\LETB=1\GOTO575
572 IFM2<>0THEN573\LETB=2\GOTO575
573 GOTO580
574 PRINT\PRINT"A DRAW"\STOP
575 PRINT\PRINT"PLAYER";B;"IS THE WINNER"\STOP
580 FORB=1TO2\PRINT\PRINT"PLAYER";B;\GOSUB700
581 IFB=99THEN560
582 NEXTB
586 LETN1(X(1),Y(1))=100\LETN1(X(2),Y(2))=1000
596 GOTO 560
700 PRINT"X,Y"\PRINT"#####";CHR$(13);\INPUTY(B),X(B)
705 IFX(B)>5THEN706\IFX(B)>0THEN708
706 GOTO750
708 IFY(B)>5THEN710\IFY(B)>0THEN 715
710 GOTO750
715 IFN1(X(B),Y(B))<>0THEN750
720 IFB<>1THEN725\RETURN
725 IFX(1)<>X(2)THEN730\IFY(1)=Y(2)THEN 740
730 RETURN
740 PRINT "SAME COORD. SET TO 0"
741 LETN1(X(B)+1,Y(B)+1)=0\LETB=99\RETURN
750 PRINT"ILLEGAL COORDS. RETYPE"\GOTO700
999 END