1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-18 08:06:27 -05:00

Add BINGO and BULCOW.

This commit is contained in:
Renaud 2024-06-10 10:43:10 +08:00
parent cf092243e9
commit a6fde12b01
3 changed files with 444 additions and 0 deletions

191
dec/BINGO.BAS Normal file
View File

@ -0,0 +1,191 @@
100 RANDOMIZE
120 PRINT"YOU ARE NOW GOING TO PLAY A COMPUTERIZED VERSION OF BINGO--"
180 LET F=1
190 DIM B(10,10)
200 DIM L(75)
210 MAT READ A$(5)
220 DATA B, I, N, G, O
235 REM THIS SEQUENCE GENERATES THE CARD NUMBERS (LINES 240-430)
240 FOR K1=1 TO 75
250 LET L(K1)=0
260 NEXT K1
270 PRINT" "," HERE'S ";
280 IF F>1 THEN 310
290 PRINT"YOUR CARD"
300 GOTO 320
310 PRINT"MY CARD"
320 LET M=16
330 LET G=F+4
340 FOR Y=F TO G
350 FOR X=F TO G
360 LET R=INT(M*RND)
370 IF R<M-15 THEN 360
380 IF L(R)<>0 THEN 360
390 LET B(X,Y)=R
400 LET L(R)=1
410 NEXT X
420 LET M=M+15
430 NEXT Y
435 REM THIS SEQUENCE PRINTS THE CARD (LINES 440-670)
440 PRINT
450 PRINT"--B--","--I--","--N--","--G--","--O--"
460 FOR X=F TO G
470 PRINT
480 PRINT
490 PRINT
500 FOR Y=F TO G
510 IF B(X,Y)=B(F+2,F+2) THEN 540
520 PRINT B(X,Y),
530 GOTO 550
540 PRINT"FREE",
550 NEXT Y
560 NEXT X
570 PRINT
580 PRINT
590 PRINT
600 PRINT"--------------------------------------------------------------------
610 PRINT" [TEAR OFF AFTER MACHINE AUTOMATICALLY ADVANCES PAPER]"
620 FOR K9=1 TO 9
630 PRINT
640 NEXT K9
650 IF F=6 THEN 680
660 LET F=6
670 GOTO 240
680 PRINT
690 PRINT"NOW WE'RE ALL SET TO PLAY THE GAME. USE A PENCIL TO MARK OFF"
700 PRINT"THE NUMBERS ON YOUR CARD AS THEY ARE CALLED."
710 PRINT" (PLEASE PLAY MY CARD AS WELL AS YOUR OWN)"
720 PRINT"***DON'T GET SMART. I'LL BE PLAYING BOTH YOUR CARD AND MINE"
730 PRINT " UP HERE IN BOSTON. (SO THERE--)"
740 PRINT
750 PRINT "ARE YOU READY";
760 INPUT R$
770 IF R$<>"NO" THEN 820
780 PRINT
790 PRINT"*********:HURRY UP:*********"
800 GOTO 740
810 REM
820 FOR K1=1 TO 75
830 LET L(K1)=0
840 NEXT K1
850 PRINT
860 LET B(3,3)=0
870 LET B(8,8)=0
875 REM THIS SEQUENCE GENERATES THE BINGO NUMBERS (LINES 880-1100)
880 LET U=INT(75*RND)+1
910 IF L(U)<>0 THEN 880
920 LET L(U)=1
930 PRINT
940 IF RND > .5 THEN 970
950 PRINT"THE NUMBER COMES UP:",
960 GOTO 980
970 PRINT"THE NEXT ONE IS:",
980 PRINT A$(INT((U-1)/15)+1);U
1105 REM THIS IS THE "NUMBER ON CARD?" SEQUENCE (LINES 1110-1260)
1110 FOR Y=1 TO 10
1120 FOR X=1 TO 10
1130 IF B(X,Y)=U THEN 1250
1140 NEXT X
1150 NEXT Y
1160 LET F=1
1170 GOSUB 1270
1180 LET F=6
1190 GOSUB 1270
1200 IF V=0 THEN 1230
1210 IF W=1 THEN 1980
1220 GOTO 2050
1230 IF W=0 THEN 880
1240 GOTO 2120
1250 LET B(X,Y)=0
1260 GOTO 1140
1265 REM THIS IS THE BINGO DETERMINING SEQUENCE (LINES 1270-1950)
1266
1267 REM THIS IS THE VERTICAL CHECK FOR BINGO*** (LINES 1270-1430)
1270 LET G=F+4
1280 FOR Y=F TO G
1290 FOR X=F TO G
1300 IF B(X,Y)<>0 THEN 1430
1310 IF X<F+4 THEN 1420
1320 IF F=6 THEN 1370
1330 PRINT
1340 PRINT"YOU'VE GOT A B I N G O * * *"
1350 LET W=1
1360 RETURN
1370 PRINT
1380 PRINT"I'VE GOT A B I N G O * * * * *"
1390 LET V=1
1410 GO TO 1450
1420 NEXT X
1430 NEXT Y
1440 REM THIS IS THE HORIZONTAL CHECK FOR BINGO*** (LINES 1450-1610)
1450 LET G=F+4
1460 FOR X=F TO G
1470 FOR Y=F TO G
1480 IF B(X,Y)<>0 THEN 1610
1490 IF Y<F+4 THEN 1600
1500 IF F=6 THEN 1550
1510 PRINT
1520 PRINT"YOU'VE GOT A B I N G O * * *"
1530 LET W=1
1540 RETURN
1550 PRINT
1560 PRINT"I'VE GOT A B I N G O * * * * *"
1570 LET V=1
1590 GO TO 1620
1600 NEXT Y
1610 NEXT X
1615 REM THIS IS THE SLANT CHECK (M=-1) FOR BINGO*** (LINES 1620-1770)
1620 LET X=F
1630 LET Y=F
1640 IF B(X,Y)<>0 THEN 1770
1650 LET X=X+1
1660 LET Y=Y+1
1670 IF Y<F+5 THEN 1640
1680 IF Y=11 THEN 1740
1690 LET W=1
1700 PRINT
1710 PRINT"YOU'VE GOT A B I N G O * * *"
1730 RETURN
1740 PRINT"I'VE GOT A B I N G O * * * * *"
1750 LET V=1
1770 RETURN
1775 REM THIS IS THE SLANT CHECK (M=1) FOR BINGO*** (LINES 1780-1950)
1780 LET X=F+4
1790 LET Y=X
1800 IF B(X,Y)<>0 THEN 1950
1810 LET X=X-1
1820 LET Y=Y+1
1830 IF Y<F+5 THEN 1800
1840 IF Y=11 THEN 1900
1850 PRINT
1860 PRINT"YOU'VE GOT A B I N G O * * *"
1870 LET W=1
1890 RETURN
1900 PRINT
1910 PRINT"I'VE GOT A B I N G O * * * * *"
1920 LET V=1
1950 RETURN
1970 REM THIS THE TIE PRINTOUT SEQUENCE
1980 PRINT
1990 PRINT" *********** IT'S A TIE ***********"
1995 REM THIS IS THE "PLAY AGAIN?" SEQUENCE
2000 PRINT
2010 PRINT "DO YOU WANT TO PLAY AGAIN";
2020 INPUT E$
2025 PRINT
2030 IF E$="YES" THEN 180
2040 STOP
2045 REM THIS IS THE "I WIN" SEQUENCE
2050 PRINT
2060 FOR S=1 TO 6
2070 PRINT"I WIN. ";
2080 NEXT S
2090 PRINT
2100 PRINT
2110 GOTO 2000
2115 REM THIS IS THE "YOU WIN" SEQUENCE
2120 PRINT
2130 PRINT" YOU WIN..... YOU WIN....... YOU WIN......."
2140 GOTO 2000
2145 REM THIS IS THE "END" OF THE LIST OF PROGRAM ENTITLED "BINGO"
2150 END

62
dec/BULCOW.BAS Normal file
View File

@ -0,0 +1,62 @@
5 GOSUB 500
10 DIMD(10,4),B(10),C(10),G(10)
15 RANDOMIZE:PRINT:PRINT:PRINT
20 LETA=0:GOTO200
30 PRINT:PRINT:PRINT:LETJ=0
35 PRINT"YOUR GUESS";:INPUTN:LETN=(N+.1)/100000
40 FORI=0TO4:LETG(I)=INT(10*N):LETN=10*N-INT(10*N)
41 FORK=0TOI-1:IFG(I)=G(K)GOTO170
42 NEXTK
43 NEXTI
45 LETP=4:LETA=0:GOSUB300
50 PRINTV"BULL";:IFV<>1THENPRINT"S";
55 IFV=5THENPRINT" - YOU WIN":GOTO20
60 PRINTW-V"COW";:IFW<>V+1THENPRINT"S";
65 IFJ=0THENLETA=1:GOTO200
68 GOSUB400
70 PRINT" - MY GUESS IS ";
75 FORI=0TO4:PRINTCHR$(D(J,I)+48);:NEXTI
80 PRINT" MY SCORE";:INPUTB(J),C(J):LETC(J)=C(J)+B(J)
81 IFB(J)>-1THENIFB(J)<6THENIFC(J)<6THENIFC(J)-B(J)>-1GOTO83
82 PRINT" - RIDICULOUS!!";:GOTO 70
83 IFB(J)=4THENIFC(J)=5GOTO82
85 IFB(J)=5THENPRINT" - I WIN - MY NUMBER WAS";:GOTO100
90 GOTO35
100 FORI=0TO4:PRINTCHR$(D(0,I)+48);:NEXTI
110 GOTO20
150 PRINT:PRINT"YOU HAVE GIVEN ME IMPOSSIBLE SCORES - GAME SPOILED"
:GOTO 5
170 PRINT"REPEATED DIGITS NOT ALLOWED":GOTO35
200 FORP=0TO4
210 LETD(A,P)=INT(10*RND(1))
220 FORI=0TOP-1:IFD(A,I)=D(A,P)GOTO210
230 NEXTI
240 NEXTP
250 IFA=0GGOTO30
260 LETJ=1:GOTO70
300 LETV=0:LETW=0
310 FORI=0TOP:IFD(A,I)=G(I)THENLETV=V+1
320 FORK=0TO4:IFD(A,K)=G(I)THENLETW=W+1
330 NEXTK
340 NEXTI
350 RETURN
400 LETP=0
405 LETG(P)=D(J,P)
410 FORI=0TOP-1:IFG(I)=G(P)GOTO430
415 NEXTI
420 FORA=1TOJ:GOSUB300
425 IFV<=B(A)THENIFW<=C(A)THENIF4-P>=C(A)-WTHENIF4-P>=B(A)-VGOTO448
430 LETG(P)=G(P)+3:IFG(P)>9THENLETG(P)=G(P)-10
432 IFP=0THENIFG(P)=D(1,0)GOTO150
435 IFG(P)<>D(J,P)GOTO410
440 LETP=P-1:IFP<0THENGOTO150
445 GOTO430
448 NEXTA
450 LETP=P+1:IFP<5GOTO405
455 LETJ=J+1
460 FORI=0TO4:LETD(J,I)=G(I):NEXTI
465 RETURN
500 PRINT:PRINT:PRINT" BRADFORD UNIVERSITY BULLS AND COW GAME
"
510 GOTO10
999 END

191
port/BINGO.BAS Normal file
View File

@ -0,0 +1,191 @@
100 RANDOMIZE
120 PRINT"YOU ARE NOW GOING TO PLAY A COMPUTERIZED VERSION OF BINGO--"
180 LET F=1
190 DIM B(10,10),A(5)
200 DIM L(75)
210 FOR I=1 TO 5\READ A(I)\NEXT I
220 DATA 66, 73, 78, 71, 79
235 REM THIS SEQUENCE GENERATES THE CARD NUMBERS (LINES 240-430)
240 FOR K1=1 TO 75
250 LET L(K1)=0
260 NEXT K1
270 PRINT" "," HERE'S ";
280 IF F>1 THEN 310
290 PRINT"YOUR CARD"
300 GOTO 320
310 PRINT"MY CARD"
320 LET M=16
330 LET G=F+4
340 FOR Y=F TO G
350 FOR X=F TO G
360 LET R=INT(M*RND(1))
370 IF R<M-15 THEN 360
380 IF L(R)<>0 THEN 360
390 LET B(X,Y)=R
400 LET L(R)=1
410 NEXT X
420 LET M=M+15
430 NEXT Y
435 REM THIS SEQUENCE PRINTS THE CARD (LINES 440-670)
440 PRINT
450 PRINT"--B--","--I--","--N--","--G--","--O--"
460 FOR X=F TO G
470 PRINT
480 PRINT
490 PRINT
500 FOR Y=F TO G
510 IF B(X,Y)=B(F+2,F+2) THEN 540
520 PRINT B(X,Y),
530 GOTO 550
540 PRINT"FREE",
550 NEXT Y
560 NEXT X
570 PRINT
580 PRINT
590 PRINT
600 PRINT"--------------------------------------------------------------------"
610 PRINT" [TEAR OFF AFTER MACHINE AUTOMATICALLY ADVANCES PAPER]"
620 FOR K9=1 TO 9
630 PRINT
640 NEXT K9
650 IF F=6 THEN 680
660 LET F=6
670 GOTO 240
680 PRINT
690 PRINT"NOW WE'RE ALL SET TO PLAY THE GAME. USE A PENCIL TO MARK OFF"
700 PRINT"THE NUMBERS ON YOUR CARD AS THEY ARE CALLED."
710 PRINT" (PLEASE PLAY MY CARD AS WELL AS YOUR OWN)"
720 PRINT"***DON'T GET SMART. I'LL BE PLAYING BOTH YOUR CARD AND MINE"
730 PRINT " UP HERE IN BOSTON. (SO THERE--)"
740 PRINT
750 PRINT "ARE YOU READY";
760 INPUT R$
770 IF R$<>"NO" THEN 820
780 PRINT
790 PRINT"*********:HURRY UP:*********"
800 GOTO 740
810 REM
820 FOR K1=1 TO 75
830 LET L(K1)=0
840 NEXT K1
850 PRINT
860 LET B(3,3)=0
870 LET B(8,8)=0
875 REM THIS SEQUENCE GENERATES THE BINGO NUMBERS (LINES 880-1100)
880 LET U=INT(75*RND(1))+1
910 IF L(U)<>0 THEN 880
920 LET L(U)=1
930 PRINT
940 IF RND(1) > .5 THEN 970
950 PRINT"THE NUMBER COMES UP:",
960 GOTO 980
970 PRINT"THE NEXT ONE IS:",
980 PRINT CHR$(A(INT((U-1)/15)+1));U
1105 REM THIS IS THE "NUMBER ON CARD?" SEQUENCE (LINES 1110-1260)
1110 FOR Y=1 TO 10
1120 FOR X=1 TO 10
1130 IF B(X,Y)=U THEN 1250
1140 NEXT X
1150 NEXT Y
1160 LET F=1
1170 GOSUB 1270
1180 LET F=6
1190 GOSUB 1270
1200 IF V=0 THEN 1230
1210 IF W=1 THEN 1980
1220 GOTO 2010
1230 IF W=0 THEN 880
1240 GOTO 2020
1250 LET B(X,Y)=0
1260 GOTO 1140
1265 REM THIS IS THE BINGO DETERMINING SEQUENCE (LINES 1270-1950)
1266 '
1267 REM THIS IS THE VERTICAL CHECK FOR BINGO*** (LINES 1270-1430)
1270 LET G=F+4
1280 FOR Y=F TO G
1290 FOR X=F TO G
1300 IF B(X,Y)<>0 THEN 1430
1310 IF X<F+4 THEN 1420
1320 IF F=6 THEN 1370
1330 PRINT
1340 PRINT"YOU'VE GOT A B I N G O * * *"
1350 LET W=1
1360 RETURN
1370 PRINT
1380 PRINT"I'VE GOT A B I N G O * * * * *"
1390 LET V=1
1410 GO TO 1450
1420 NEXT X
1430 NEXT Y
1440 REM THIS IS THE HORIZONTAL CHECK FOR BINGO*** (LINES 1450-1610)
1450 LET G=F+4
1460 FOR X=F TO G
1470 FOR Y=F TO G
1480 IF B(X,Y)<>0 THEN 1610
1490 IF Y<F+4 THEN 1600
1500 IF F=6 THEN 1550
1510 PRINT
1520 PRINT"YOU'VE GOT A B I N G O * * *"
1530 LET W=1
1540 RETURN
1550 PRINT
1560 PRINT"I'VE GOT A B I N G O * * * * *"
1570 LET V=1
1590 GO TO 1620
1600 NEXT Y
1610 NEXT X
1615 REM THIS IS THE SLANT CHECK (M=-1) FOR BINGO*** (LINES 1620-1770)
1620 LET X=F
1630 LET Y=F
1640 IF B(X,Y)<>0 THEN 1770
1650 LET X=X+1
1660 LET Y=Y+1
1670 IF Y<F+5 THEN 1640
1680 IF Y=11 THEN 1740
1690 LET W=1
1700 PRINT
1710 PRINT"YOU'VE GOT A B I N G O * * *"
1730 RETURN
1740 PRINT"I'VE GOT A B I N G O * * * * *"
1750 LET V=1
1770 RETURN
1775 REM THIS IS THE SLANT CHECK (M=1) FOR BINGO*** (LINES 1780-1950)
1780 LET X=F+4
1790 LET Y=X
1800 IF B(X,Y)<>0 THEN 1950
1810 LET X=X-1
1820 LET Y=Y+1
1830 IF Y<F+5 THEN 1800
1840 IF Y=11 THEN 1900
1850 PRINT
1860 PRINT"YOU'VE GOT A B I N G O * * *"
1870 LET W=1
1890 RETURN
1900 PRINT
1910 PRINT"I'VE GOT A B I N G O * * * * *"
1920 LET V=1
1950 RETURN
1970 REM THIS THE TIE PRINTOUT SEQUENCE
1980 PRINT
1990 PRINT" *********** IT'S A TIE ***********"
1995 REM THIS IS THE "PLAY AGAIN?" SEQUENCE
2000 PRINT
2001 PRINT "DO YOU WANT TO PLAY AGAIN";
2002 INPUT E$
2003 PRINT
2004 IF E$="YES" THEN 180
2005 STOP
2009 REM THIS IS THE "I WIN" SEQUENCE
2010 PRINT
2011 FOR S=1 TO 6
2012 PRINT"I WIN. ";
2013 NEXT S
2014 PRINT
2015 PRINT
2016 GOTO 2000
2019 REM THIS IS THE "YOU WIN" SEQUENCE
2020 PRINT
2021 PRINT" YOU WIN..... YOU WIN....... YOU WIN......."
2022 GOTO 2000
2045 REM THIS IS THE "END" OF THE LIST OF PROGRAM ENTITLED "BINGO"
2046 END