1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-17 23:56:24 -05:00

Add 1CHECK, BATNUM, CRAPS, GOMOKO.

This commit is contained in:
Renaud 2024-05-12 16:47:38 +08:00
parent b214337800
commit f2a40617c5
8 changed files with 671 additions and 0 deletions

85
dec/1CHECK.BAS Normal file
View File

@ -0,0 +1,85 @@
5 PRINT
10 PRINT "SOLITAIRE CHECKER PUZZLE BY DAVID AHL"
15 PRINT
20 PRINT "48 CHECKERS ARE PLACED ON THE 2 OUTSIDE SPACES OF A"
25 PRINT "STANDARD 64-SQUARE CHECKERBOARD. THE OBJECT IS TO"
30 PRINT "REMOVE AS MANY CHECKERS AS POSSIBLE BY DIAGONAL JUMPS"
35 PRINT "(AS IN STANDARD CHECKERS). USE THE NUMBERED BOARD TO"
40 PRINT "INDICATE THE SQUARE YOU WISH TO JUMP FROM AND TO. ON"
45 PRINT "THE BOARD PRINTED OUT ON EACH TURN '1' INDICATES A"
50 PRINT "CHECKER AND '0' AN EMPTY SQUARE. WHEN YOU HAVE NO"
55 PRINT "POSSIBLE JUMPS REMAINING, INPUT A '0' IN RESPONSE TO"
60 PRINT "QUESTION 'JUMP FROM ?'"
62 PRINT
63 PRINT "HERE IS THE NUMERICAL BOARD:"
66 PRINT
68 DIM A(64)
70 FOR J=1 TO 57 STEP 8
72 B$="## ## ## ## ## ## ## ##"
74 PRINT USING B$,J,J+1,J+2,J+3,J+4,J+5,J+6,J+7
76 NEXT J
77 PRINT
78 PRINT "AND HERE IS THE OPENING POSITION OF THE CHECKERS:"
79 PRINT
80 FOR J=1 TO 64
82 A(J)=1
84 NEXT J
86 FOR J=19 TO 43 STEP 8
88 FOR I=J TO J+3
90 A(I)=0
92 NEXT I
94 NEXT J
96 M=0
98 GOTO 340
100 INPUT "JUMP FROM";F
105 IF F=0 THEN 500
110 INPUT "TO";T
112 PRINT
118 REM *** CHECK LEGALITY OF MOVE
120 F1=INT((F-1)/8)
130 F2=F-8*F1
140 T1=INT((T-1)/8)
150 T2=T-8*T1
160 IF F1>7 THEN 230
170 IF T1>7 THEN 230
180 IF F2>8 THEN 230
190 IF T2>8 THEN 230
200 IF ABS(F1-T1)<>2 THEN 230
210 IF ABS(F2-T2)<>2 THEN 230
212 IF A((T+F)/2)=0 THEN 230
215 IF A(F)=0 THEN 230
220 IF A(T)=1 THEN 230
225 GOTO 250
230 PRINT "ILLEGAL MOVE. TRY AGAIN..."
240 GOTO 100
245 REM *** UPDATE BOARD
250 A(T)=1
260 A(F)=0
270 A((T+F)/2)=0
290 M=M+1
310 REM *** PRINT BOARD
340 FOR J=1 TO 57 STEP 8
350 FOR I=J TO J+7
360 PRINT A(I);
370 NEXT I
380 PRINT
390 NEXT J
400 PRINT
410 GOTO 100
490 REM *** END GAME SUMMARY
500 S=0
510 FOR I=1 TO 64
520 S=S+A(I)
530 NEXT I
535 PRINT
540 PRINT "YOU MADE"M"JUMPS AND HAD"S"PIECES"
550 PRINT "REMAINING ON THE BOARD."
560 PRINT
562 INPUT "TRY AGAIN";A$
570 IF A$="YES" THEN 70
575 IF A$="NO" THEN 600
580 PRINT "PLEASE ANSWER 'YES' OR 'NO'."
590 GOTO 562
600 PRINT
610 PRINT "O.K. HOPE YOU HAD FUN!"
999 END

89
dec/BATNUM.BAS Normal file
View File

@ -0,0 +1,89 @@
110 PRINT "THIS PROGRAM IS A 'BATTLE OF NUMBERS'"
120 PRINT"GAME, WHERE THE COMPUTER IS YOUR OPPONENT."
130 PRINT
140 PRINT"THE GAME STARTS WITH AN ASSUMED PILE OF OBJECTS. YOU AND"
150 PRINT"YOUR OPPONENT ALTERNATLY REMOVE OBJECTS FROM THE PILE."
160 PRINT"WINNING IS DEFINED IN ADVANCE AS TAKING THE LAST OBJECT"
170 PRINT"OR NOT. YOU CAN ALSO SPECIFY SOME OTHER BEGINNING"
180 PRINT"CONDITIONS. DON'T USE ZERO, HOWEVER, IN PLAYING THE GAME."
200 PRINT
210 GOTO 330
220 FOR I=1 TO 10
230 PRINT
240 NEXT I
330 PRINT"ENTER PILE SIZE:";
340 INPUT N
350 IF N<>0 THEN 370
360 GOTO 330
370 IF N<>INT(N) THEN 220
380 IF N<1 THEN 220
390 PRINT "ENTER WIN OPTION - 1 TO TAKE LAST, 2 TO AVOID LAST: ";
400 INPUT M
410 IF M=1 THEN 430
420 IF M<>2 THEN 390
430 PRINT "ENTER MIN AND MAX: ";
440 INPUT A,B
450 IF A>B THEN 430
460 IF A<1 THEN 430
470 IF A<>INT(A) THEN 430
480 IF B<>INT(B) THEN 430
490 PRINT"ENTER START OPTION - 1 COMPUTER FIRST, 2 YOU FIRST:";
500 INPUT S
510 IF S=1 THEN 530
520 IF S<>2 THEN 490
530 LET C=A+B
540 IF S=2 THEN 570
550 GOSUB 600
560 IF W=1 THEN 220
570 GOSUB 810
580 IF W=1 THEN 220
590 GOTO 550
600 LET Q=N
610 IF M=1 THEN 630
620 LET Q=Q-1
630 IF M=1 THEN 680
640 IF N>A THEN 720
650 LET W=1
660 PRINT"COMPUTER TAKES";N;"AND LOSES."
670 RETURN
680 IF N>B THEN 720
690 LET W=1
700 PRINT "COMPUTER TAKES";N;"AND WINS."
710 RETURN
720 LET P=Q-C*INT(Q/C)
730 IF P>=A THEN 750
740 LET P=A
750 IF P<=B THEN 770
760 LET P=B
770 LET N=N-P
780 PRINT"COMPUTER TAKES";P;"AND LEAVES";N
790 LET W=0
800 RETURN
810 PRINT "YOUR MOVE: ";
820 INPUT P
830 IF P<>0 THEN 870
840 PRINT "I TOLD YOU NOT TO USE ZERO...COMPUTER WINS BY FORFEIT."
850 LET W=1
860 RETURN
870 IF P<>INT(P) THEN 920
880 IF P>=A THEN 910
890 IF P=N THEN 960
900 GOTO 920
910 IF P<=B THEN 940
920 PRINT "ILLEGAL MOVE, REENTER IT: ";
930 GOTO 820
940 LET N=N-P
950 IF N<>0 THEN 1030
960 IF M=1 THEN 1000
970 PRINT"TOUGH LUCK, YOU LOSE."
980 LET W=1
990 RETURN
1000 PRINT"CONGRATULATIONS, YOU WIN."
1010 LET W=1
1020 RETURN
1030 IF N>=0 THEN 1060
1040 LET N=N+P
1050 GOTO 920
1060 LET W=0
1070 RETURN
1080 END

110
dec/CRAPS.BAS Normal file
View File

@ -0,0 +1,110 @@
80 RANDOMIZE
90 FOR I=1 TO 10\PRINT\NEXT I
100 PRINT"THIS DEMONSTRATION SIMULATES A CRAP GAME WITH THE COMPUTER"
110 PRINT"AS YOUR OPPONENT. THE RULES ARE SIMPLE:"
120 PRINT
130 PRINT" *A 7 OR 11 ON THE FIRST ROLL WINS"
140 PRINT" *A 2, 3 OR 12 ON THE FIRST ROLL LOSES"
150 PRINT
160 PRINT"ANY OTHER NUMBER ROLLED BECOMES YOUR 'POINT'* YOU CONTINUE"
170 PRINT"TO ROLL...IF YOU GET YOUR POINT, YOU WIN. IF YOU ROLL A 7,"
180 PRINT"YOU LOSE. THE DICE CHANGE HANDS WHEN THIS HAPPENS."
185 PRINT "JUST BET $0 TO QUIT."
190 PRINT
200 PRINT
210 LET Z=5*INT(10+11*RND(0))
215 PRINT "ARE YOU READY";\INPUT B$
216 IF B$="YES" THEN 220\IF B$="NO" THEN PRINT "I'LL REPEAT MYSELF THEN."
217 GOTO 90
220 PRINT"SPLENDID......YOU ARE GIVEN ";Z;"DOLLARS TO PLAY WITH."
230 PRINT
240 PRINT
250 IF N-2*INT(N/2)=0 THEN 310
260 LET W=-1
270 PRINT "I'LL ROLL FIRST....."
280 PRINT
290 PRINT
300 GOTO 350
310 LET W=1
320 PRINT "YOU ROLL FIRST...."
330 PRINT
340 PRINT
350 LET Q=0
360 PRINT "HOW MUCH DO YOU BET";
370 INPUT B
380 PRINT
390 IF B=INT(B) THEN 430
400 PRINT
410 PRINT "NO COINS PERMITTED...JUST BILLS, PLEASE."
420 GOTO 360
430 IF B=0 THEN 1090
440 IF B<Z+1 THEN 470
450 PRINT "DON'T TRY TO BET MORE THAN YOU HAVE, PLEASE."
460 GOTO 360
470 LET D1=INT(6*RND(0)+1)
480 LET D2=INT(6*RND(0)+1)
490 LET Q=Q+1
500 LET S=D1+D2
510 IF W>0 THEN 540
520 PRINT " I ROLL ";D1;"AND ";D2;
530 GOTO 550
540 PRINT "YOU ROLL ";D1;"AND ";D2;
550 IF Q<>1 THEN 860
560 IF (S-2)*(S-3)*(S-12)=0 THEN 640
570 IF (S-7)*(S-11)=0 THEN 710
580 IF W>0 THEN 610
590 PRINT "SO MY POINT IS";S
600 GOTO 620
610 PRINT "SO YOUR POINT IS";S
620 LET P=S
630 GOTO 470
640 PRINT "AND CRAP OUT..."
650 LET C=1
660 IF W>0 THEN 690
670 LET Z=Z+B
680 GOTO 770
690 LET Z=Z-B
700 GOTO 770
710 PRINT "AND PASS...."
720 LET C=1
730 IF W>0 THEN 760
740 LET Z=Z-B
750 GOTO 770
760 LET Z=Z+B
770 PRINT
780 IF Z<1 THEN 1060
790 PRINT "YOU NOW HAVE ";Z;"DOLLARS"
800 IF C>0 THEN 830
810 PRINT "CHANGE DICE NOW..."
820 PRINT
830 LET W=W*C
840 LET Q=0
850 GOTO 360
860 IF S<>7 THEN 940
870 PRINT "AND LOSE..."
880 LET C=-1
890 IF W>0 THEN 920
900 LET Z=Z+B
910 GOTO 770
920 LET Z=Z-B
930 GOTO 770
940 IF S=P THEN 970
950 PRINT "...ROLL AGAIN."
960 GOTO 470
970 IF W>0 THEN 1020
980 PRINT "AND MAKE MY POINT"
990 LET C=1
1000 LET Z=Z-B
1010 GOTO 770
1020 PRINT "AND MAKE YOUR POINT"
1030 LET C=1
1040 LET Z=Z+B
1050 GOTO 770
1060 PRINT
1070 PRINT "YOU HAVE RUN OUT OF MONEY....SORRY ABOUT THAT."
1080 GOTO 1110
1090 PRINT "THANKS FOR THE GAME. AND CONGRATULATIONS"
1100 PRINT "FOR BEING ABLE TO QUIT WHILE YOU WERE AHEAD."
1110 PRINT\PRINT\PRINT
1120 CHAIN$ "DEMOES"
1130 END

50
dec/GOMOKO.BAS Normal file
View File

@ -0,0 +1,50 @@
10 PRINT\PRINT "WELCOME TO THE ORIENTAL GAME OF GOMOKO"
20 PRINT\PRINT "THE GAME IS PLAYED ON AN N BY N GRID OF A SIZE"
30 PRINT "THAT YOU SPECIFY. DURING YOUR PLAY, YOU MAY COVER ONE GRID"
40 PRINT "INTERSECTION WITH A MARKER. THE OBJECT OF THE GAME IS TO GET"
50 PRINT "5 ADJACENT MARKERS IN A ROW -- HORIZONTALLY, VERTICALLY, OR"
60 PRINT "ALONG EITHER DIAGONAL. ON THE BOARD DIAGRAM, YOUR MOVES ARE"
70 PRINT "MARKED WITH A '1', AND THE COMPUTER MOVES WITH A '2'."
80 PRINT\PRINT "THE COMPUTER DOES NOT KEEP TRACK OF WHO HAS WON."
90 PRINT "TO END THE GAME, TYPE '-1,-1' FOR YOUR MOVE"\PRINT
110 PRINT "WHAT IS YOUR BOARD SIZE (MIN =7, MAX = 19)";\INPUT N
115 IF N>6 THEN 117
116 GOTO 120
117 IF N<20 THEN 300
120 PRINT "I SAID, THE MINIMUM SIZE IS 7, AND THE MAXIMUM IS 19."\GOTO 110
210 FOR I=1 TO N\FOR J=1 TO N\A(X,Y)=0\NEXT J\NEXT I
300 PRINT\PRINT "WE ALTERNATE MOVES. YOU GO FIRST..."\PRINT
310 PRINT "YOUR PLAY (I,J)";\INPUT I,J
320 IF I=-1 THEN 980
330 X=I\Y=J\GOSUB 910\IF L=1 THEN 410
340 PRINT "ILLEGAL MOVE. TRY AGAIN..."\GOTO 310
410 IF A(I,J)=0 THEN 440
420 PRINT "SQUARE OCCUPIED. TRY AGAIN..."\GOTO 310
440 A(I,J)=1
500 REM *** COMPUTER TRIES AN 'INTELLIGENT' MOVE ***
510 FOR E=-1 TO 1\ FOR F=-1 TO 1\ IF E+F-E*F=0 THEN 590
540 LET X=I+E\Y=J+F\GOSUB 910
570 IF L=0 THEN 590
580 IF A(X,Y)=1 THEN 710
590 NEXT F\NEXT E
600 REM *** COMPUTER TRIES A RANDOM MOVE ***
610 LET X=INT(N*RND(0)+1)\LET Y=INT(N*RND(0)+1)\GOSUB 910\IF L=0 THEN 610
650 IF A(X,Y)<>0 THEN 610
660 A(X,Y)=2\GOSUB 810\GOTO 310
710 X=I-E\Y=J-F\GOSUB 910
750 IF L=0 THEN 610
760 GOTO 650
800 REM *** PRINT THE BOARD ***
810 FOR I=1 TO N\FOR J=1 TO N\PRINT A(I,J);
840 NEXT J\PRINT \NEXT I\PRINT \RETURN
900 REM *** CHECK WHETHER MOVE IS LEGAL ***
910 L=1\IF X<1 THEN 970
920 IF X>N THEN 970
930 IF Y<1 THEN 970
940 IF Y>N THEN 970
950 RETURN
970 L=0\RETURN
980 PRINT\PRINT "THANKS FOR THE GAME!!"
985 PRINT "PLAY AGAIN (1 FOR YES, 0 FOR NO)";\ INPUT Q
990 IF Q=1 THEN 110
999 END

87
port/1CHECK.BAS Normal file
View File

@ -0,0 +1,87 @@
5 PRINT
10 PRINT "SOLITAIRE CHECKER PUZZLE BY DAVID AHL"
15 PRINT
20 PRINT "48 CHECKERS ARE PLACED ON THE 2 OUTSIDE SPACES OF A"
25 PRINT "STANDARD 64-SQUARE CHECKERBOARD. THE OBJECT IS TO"
30 PRINT "REMOVE AS MANY CHECKERS AS POSSIBLE BY DIAGONAL JUMPS"
35 PRINT "(AS IN STANDARD CHECKERS). USE THE NUMBERED BOARD TO"
40 PRINT "INDICATE THE SQUARE YOU WISH TO JUMP FROM AND TO. ON"
45 PRINT "THE BOARD PRINTED OUT ON EACH TURN '1' INDICATES A"
50 PRINT "CHECKER AND '0' AN EMPTY SQUARE. WHEN YOU HAVE NO"
55 PRINT "POSSIBLE JUMPS REMAINING, INPUT A '0' IN RESPONSE TO"
60 PRINT "QUESTION 'JUMP FROM ?'"
62 PRINT
63 PRINT "HERE IS THE NUMERICAL BOARD:"
66 PRINT
68 DIM A(64)
70 FOR J=1 TO 57 STEP 8
72 FOR I=0 TO 7
73 PRINT TAB(4*I);J+I;
74 NEXT I
75 PRINT
76 NEXT J
77 PRINT
78 PRINT "AND HERE IS THE OPENING POSITION OF THE CHECKERS:"
79 PRINT
80 FOR J=1 TO 64
82 A(J)=1
84 NEXT J
86 FOR J=19 TO 43 STEP 8
88 FOR I=J TO J+3
90 A(I)=0
92 NEXT I
94 NEXT J
96 M=0
98 GOTO 340
100 PRINT "JUMP FROM";\INPUT F
105 IF F=0 THEN 500
110 PRINT "TO";\INPUT T
112 PRINT
118 REM *** CHECK LEGALITY OF MOVE
120 F1=INT((F-1)/8)
130 F2=F-8*F1
140 T1=INT((T-1)/8)
150 T2=T-8*T1
160 IF F1>7 THEN 230
170 IF T1>7 THEN 230
180 IF F2>8 THEN 230
190 IF T2>8 THEN 230
200 IF ABS(F1-T1)<>2 THEN 230
210 IF ABS(F2-T2)<>2 THEN 230
212 IF A((T+F)/2)=0 THEN 230
215 IF A(F)=0 THEN 230
220 IF A(T)=1 THEN 230
225 GOTO 250
230 PRINT "ILLEGAL MOVE. TRY AGAIN..."
240 GOTO 100
245 REM *** UPDATE BOARD
250 A(T)=1
260 A(F)=0
270 A((T+F)/2)=0
290 M=M+1
310 REM *** PRINT BOARD
340 FOR J=1 TO 57 STEP 8
350 FOR I=J TO J+7
360 PRINT A(I);
370 NEXT I
380 PRINT
390 NEXT J
400 PRINT
410 GOTO 100
490 REM *** END GAME SUMMARY
500 S=0
510 FOR I=1 TO 64
520 S=S+A(I)
530 NEXT I
535 PRINT
540 PRINT "YOU MADE"M"JUMPS AND HAD"S"PIECES"
550 PRINT "REMAINING ON THE BOARD."
560 PRINT
562 PRINT "TRY AGAIN";\INPUT A$
570 IF A$="YES" THEN 70
575 IF A$="NO" THEN 600
580 PRINT "PLEASE ANSWER 'YES' OR 'NO'."
590 GOTO 562
600 PRINT
610 PRINT "O.K. HOPE YOU HAD FUN!"
999 END

89
port/BATNUM.BAS Normal file
View File

@ -0,0 +1,89 @@
110 PRINT "THIS PROGRAM IS A 'BATTLE OF NUMBERS'"
120 PRINT"GAME, WHERE THE COMPUTER IS YOUR OPPONENT."
130 PRINT
140 PRINT"THE GAME STARTS WITH AN ASSUMED PILE OF OBJECTS. YOU AND"
150 PRINT"YOUR OPPONENT ALTERNATLY REMOVE OBJECTS FROM THE PILE."
160 PRINT"WINNING IS DEFINED IN ADVANCE AS TAKING THE LAST OBJECT"
170 PRINT"OR NOT. YOU CAN ALSO SPECIFY SOME OTHER BEGINNING"
180 PRINT"CONDITIONS. DON'T USE ZERO, HOWEVER, IN PLAYING THE GAME."
200 PRINT
210 GOTO 330
220 FOR I=1 TO 10
230 PRINT
240 NEXT I
330 PRINT"ENTER PILE SIZE:";
340 INPUT N
350 IF N<>0 THEN 370
360 GOTO 330
370 IF N<>INT(N) THEN 220
380 IF N<1 THEN 220
390 PRINT "ENTER WIN OPTION - 1 TO TAKE LAST, 2 TO AVOID LAST: ";
400 INPUT M
410 IF M=1 THEN 430
420 IF M<>2 THEN 390
430 PRINT "ENTER MIN AND MAX: ";
440 INPUT A,B
450 IF A>B THEN 430
460 IF A<1 THEN 430
470 IF A<>INT(A) THEN 430
480 IF B<>INT(B) THEN 430
490 PRINT"ENTER START OPTION - 1 COMPUTER FIRST, 2 YOU FIRST:";
500 INPUT S
510 IF S=1 THEN 530
520 IF S<>2 THEN 490
530 LET C=A+B
540 IF S=2 THEN 570
550 GOSUB 600
560 IF W=1 THEN 220
570 GOSUB 810
580 IF W=1 THEN 220
590 GOTO 550
600 LET Q=N
610 IF M=1 THEN 630
620 LET Q=Q-1
630 IF M=1 THEN 680
640 IF N>A THEN 720
650 LET W=1
660 PRINT"COMPUTER TAKES";N;"AND LOSES."
670 RETURN
680 IF N>B THEN 720
690 LET W=1
700 PRINT "COMPUTER TAKES";N;"AND WINS."
710 RETURN
720 LET P=Q-C*INT(Q/C)
730 IF P>=A THEN 750
740 LET P=A
750 IF P<=B THEN 770
760 LET P=B
770 LET N=N-P
780 PRINT"COMPUTER TAKES";P;"AND LEAVES";N
790 LET W=0
800 RETURN
810 PRINT "YOUR MOVE: ";
820 INPUT P
830 IF P<>0 THEN 870
840 PRINT "I TOLD YOU NOT TO USE ZERO...COMPUTER WINS BY FORFEIT."
850 LET W=1
860 RETURN
870 IF P<>INT(P) THEN 920
880 IF P>=A THEN 910
890 IF P=N THEN 960
900 GOTO 920
910 IF P<=B THEN 940
920 PRINT "ILLEGAL MOVE, REENTER IT: ";
930 GOTO 820
940 LET N=N-P
950 IF N<>0 THEN 1030
960 IF M=1 THEN 1000
970 PRINT"TOUGH LUCK, YOU LOSE."
980 LET W=1
990 RETURN
1000 PRINT"CONGRATULATIONS, YOU WIN."
1010 LET W=1
1020 RETURN
1030 IF N>=0 THEN 1060
1040 LET N=N+P
1050 GOTO 920
1060 LET W=0
1070 RETURN
1080 END

110
port/CRAPS.BAS Normal file
View File

@ -0,0 +1,110 @@
80 RANDOMIZE
90 FOR I=1 TO 10\PRINT\NEXT I
100 PRINT"THIS DEMONSTRATION SIMULATES A CRAP GAME WITH THE COMPUTER"
110 PRINT"AS YOUR OPPONENT. THE RULES ARE SIMPLE:"
120 PRINT
130 PRINT" *A 7 OR 11 ON THE FIRST ROLL WINS"
140 PRINT" *A 2, 3 OR 12 ON THE FIRST ROLL LOSES"
150 PRINT
160 PRINT"ANY OTHER NUMBER ROLLED BECOMES YOUR 'POINT'* YOU CONTINUE"
170 PRINT"TO ROLL...IF YOU GET YOUR POINT, YOU WIN. IF YOU ROLL A 7,"
180 PRINT"YOU LOSE. THE DICE CHANGE HANDS WHEN THIS HAPPENS."
185 PRINT "JUST BET $0 TO QUIT."
190 PRINT
200 PRINT
210 LET Z=5*INT(10+11*RND(0))
215 PRINT "ARE YOU READY";\INPUT B$
216 IF B$="YES" THEN 220\IF B$<>"NO" THEN 215\PRINT "I'LL REPEAT MYSELF THEN."
217 GOTO 90
220 PRINT"SPLENDID......YOU ARE GIVEN ";Z;"DOLLARS TO PLAY WITH."
230 PRINT
240 PRINT
250 IF N-2*INT(N/2)=0 THEN 310
260 LET W=-1
270 PRINT "I'LL ROLL FIRST....."
280 PRINT
290 PRINT
300 GOTO 350
310 LET W=1
320 PRINT "YOU ROLL FIRST...."
330 PRINT
340 PRINT
350 LET Q=0
360 PRINT "HOW MUCH DO YOU BET";
370 INPUT B
380 PRINT
390 IF B=INT(B) THEN 430
400 PRINT
410 PRINT "NO COINS PERMITTED...JUST BILLS, PLEASE."
420 GOTO 360
430 IF B<=0 THEN 1090
440 IF B<Z+1 THEN 470
450 PRINT "DON'T TRY TO BET MORE THAN YOU HAVE, PLEASE."
460 GOTO 360
470 LET D1=INT(6*RND(0)+1)
480 LET D2=INT(6*RND(0)+1)
490 LET Q=Q+1
500 LET S=D1+D2
510 IF W>0 THEN 540
520 PRINT " I ROLL ";D1;"AND ";D2;
530 GOTO 550
540 PRINT "YOU ROLL ";D1;"AND ";D2;
550 IF Q<>1 THEN 860
560 IF (S-2)*(S-3)*(S-12)=0 THEN 640
570 IF (S-7)*(S-11)=0 THEN 710
580 IF W>0 THEN 610
590 PRINT "SO MY POINT IS";S
600 GOTO 620
610 PRINT "SO YOUR POINT IS";S
620 LET P=S
630 GOTO 470
640 PRINT "AND CRAP OUT..."
650 LET C=1
660 IF W>0 THEN 690
670 LET Z=Z+B
680 GOTO 770
690 LET Z=Z-B
700 GOTO 770
710 PRINT "AND PASS...."
720 LET C=1
730 IF W>0 THEN 760
740 LET Z=Z-B
750 GOTO 770
760 LET Z=Z+B
770 PRINT
780 IF Z<1 THEN 1060
790 PRINT "YOU NOW HAVE ";Z;"DOLLARS"
800 IF C>0 THEN 830
810 PRINT "CHANGE DICE NOW..."
820 PRINT
830 LET W=W*C
840 LET Q=0
850 GOTO 360
860 IF S<>7 THEN 940
870 PRINT "AND LOSE..."
880 LET C=-1
890 IF W>0 THEN 920
900 LET Z=Z+B
910 GOTO 770
920 LET Z=Z-B
930 GOTO 770
940 IF S=P THEN 970
950 PRINT "...ROLL AGAIN."
960 GOTO 470
970 IF W>0 THEN 1020
980 PRINT "AND MAKE MY POINT"
990 LET C=1
1000 LET Z=Z-B
1010 GOTO 770
1020 PRINT "AND MAKE YOUR POINT"
1030 LET C=1
1040 LET Z=Z+B
1050 GOTO 770
1060 PRINT
1070 PRINT "YOU HAVE RUN OUT OF MONEY....SORRY ABOUT THAT."
1080 GOTO 1110
1090 PRINT "THANKS FOR THE GAME. AND CONGRATULATIONS"
1100 PRINT "FOR BEING ABLE TO QUIT WHILE YOU WERE AHEAD."
1110 PRINT\PRINT\PRINT
1120 CHAIN "DEMOES"
1130 END

51
port/GOMOKO.BAS Normal file
View File

@ -0,0 +1,51 @@
10 PRINT\PRINT "WELCOME TO THE ORIENTAL GAME OF GOMOKO"
20 PRINT\PRINT "THE GAME IS PLAYED ON AN N BY N GRID OF A SIZE"
30 PRINT "THAT YOU SPECIFY. DURING YOUR PLAY, YOU MAY COVER ONE GRID"
40 PRINT "INTERSECTION WITH A MARKER. THE OBJECT OF THE GAME IS TO GET"
50 PRINT "5 ADJACENT MARKERS IN A ROW -- HORIZONTALLY, VERTICALLY, OR"
60 PRINT "ALONG EITHER DIAGONAL. ON THE BOARD DIAGRAM, YOUR MOVES ARE"
70 PRINT "MARKED WITH A '1', AND THE COMPUTER MOVES WITH A '2'."
80 PRINT\PRINT "THE COMPUTER DOES NOT KEEP TRACK OF WHO HAS WON."
90 PRINT "TO END THE GAME, TYPE '-1,-1' FOR YOUR MOVE"\PRINT
100 DIM A(16,16)\RANDOMIZE
110 PRINT "WHAT IS YOUR BOARD SIZE (MIN =7, MAX = 16)";\INPUT N
115 IF N>6 THEN 117
116 GOTO 120
117 IF N<17 THEN 200
120 PRINT "I SAID, THE MINIMUM SIZE IS 7, AND THE MAXIMUM IS 16."\GOTO 110
200 FOR I=1 TO N\FOR J=1 TO N\A(I,J)=0\NEXT J\NEXT I
300 PRINT\PRINT "WE ALTERNATE MOVES. YOU GO FIRST..."\PRINT
310 PRINT "YOUR PLAY (I,J)";\INPUT I,J
320 IF I=-1 THEN 980
330 X=I\Y=J\GOSUB 910\IF L=1 THEN 410
340 PRINT "ILLEGAL MOVE. TRY AGAIN..."\GOTO 310
410 IF A(I,J)=0 THEN 440
420 PRINT "SQUARE OCCUPIED. TRY AGAIN..."\GOTO 310
440 A(I,J)=1
500 REM *** COMPUTER TRIES AN 'INTELLIGENT' MOVE ***
510 FOR E=-1 TO 1\ FOR F=-1 TO 1\ IF E+F-E*F=0 THEN 590
540 LET X=I+E\Y=J+F\GOSUB 910
570 IF L=0 THEN 590
580 IF A(X,Y)=1 THEN 710
590 NEXT F\NEXT E
600 REM *** COMPUTER TRIES A RANDOM MOVE ***
610 LET X=INT(N*RND(0)+1)\LET Y=INT(N*RND(0)+1)\GOSUB 910\IF L=0 THEN 610
650 IF A(X,Y)<>0 THEN 610
660 A(X,Y)=2\GOSUB 810\GOTO 310
710 X=I-E\Y=J-F\GOSUB 910
750 IF L=0 THEN 610
760 GOTO 650
800 REM *** PRINT THE BOARD ***
810 FOR I=1 TO N\FOR J=1 TO N\PRINT A(I,J);
840 NEXT J\PRINT \NEXT I\PRINT \RETURN
900 REM *** CHECK WHETHER MOVE IS LEGAL ***
910 L=1\IF X<1 THEN 970
920 IF X>N THEN 970
930 IF Y<1 THEN 970
940 IF Y>N THEN 970
950 RETURN
970 L=0\RETURN
980 PRINT\PRINT "THANKS FOR THE GAME!!"
985 PRINT "PLAY AGAIN (1 FOR YES, 0 FOR NO)";\ INPUT Q
990 IF Q=1 THEN 110
999 END