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

Add AWARI, EVEN1, REVRSE, ROCKET, WAR.

This commit is contained in:
Renaud 2024-05-11 10:25:54 +08:00
parent f58694e15c
commit b214337800
10 changed files with 594 additions and 0 deletions

69
dec/AWARI.BAS Normal file
View File

@ -0,0 +1,69 @@
5 DATA0
10 DIMB(13),G(13),F(50):READN
15 FORI=0TON-1:READF(I):NEXTI
20 PRINT\PRINT "GAME OF *** AWARI ***"\E=0
25 FORI=0TO12:LETB(I)=3:NEXTI
30 LETC=0:LETF(N)=0:LETB(13)=0:LETB(6)=0
35 GOSUB 500
40 PRINT"YOUR MOVE";:GOSUB 110
45 IFE=0GOTO80
50 IFM=HTHENGOSUB100
55 IFE=0GOTO80
60 PRINT"MY MOVE IS ";:GOSUB800
65 IFE=0GOTO80
70 IFM=HTHENPRINT",";:GOSUB800
75 IFE>0GOTO35
80 PRINT:PRINT"GAME OVER"
85 LET D=B(6)-B(13):IF D<0 THEN PRINT "I WIN BY";-D"POINTS":GOTO 20
90 LETN=N+1:IFD=0THENPRINT"DRAWN GAME":GOTO 20
95 PRINT"YOU WIN BY"D"POINTS":GOTO20
100 PRINT "AGAIN";
110 INPUTM:IFM<7THENIFM>0THENLETM=M-1:GOTO130
120 PRINT"ILLEGAL MOVE":GOTO100
130 IFB(M)=0GOTO120
140 LETH=6:GOSUB200
150 GOTO500
200 LETK=M:GOSUB600
205 LETE=0:IFK>6THENK=K-7
210 LETC=C+1:IFC<9THENLETF(N)=F(N)*6+K
215 FORI=0TO5:IFB(I)<>0THEN230
220 NEXTI
225 RETURN
230 FORI=7TO12:IFB(I)<>0THENLETE=1:RETURN
235 GOTO220
500 PRINT:PRINT" ";
505 FORI=12TO7STEP-1:GOSUB580
510 NEXTI
515 PRINT:LETI=13:GOSUB580
520 PRINT," ";:PRINTB(6):PRINT" ";
525 FORI=0TO5:GOSUB580
530 NEXTI
535 PRINT:PRINT:RETURN
580 IFB(I)<10THENPRINT" ";
585 PRINTB(I);:RETURN
600 LETP=B(M):LETB(M)=0
605 FORP=PTO1STEP-1:LETM=M+1:IFM>13THENLETM=M-14
610 LETB(M)=B(M)+1:NEXTP
615 IFB(M)=1THENIFM<>6THENIFM<>13THENIFB(12-M)<>0GOTO625
620 RETURN
625 LETB(H)=B(H)+B(12-M)+1:LETB(M)=0:LETB(12-M)=0:RETURN
800 LETD=-99:LETH=13
805 FORI=0TO13:LETG(I)=B(I):NEXTI
810 FORJ=7TO12:IFB(J)=0THEN885
815 LETQ=0:LETM=J:GOSUB600
820 FORI=0TO5:IFB(I)=0THEN845
825 LETL=B(I)+I:LETR=0
830 IFL>13THENLETL=L-14:LETR=1:GOTO830
835 IFB(L)=0THENIFL<>6THENIFL<>13THENLETR=B(12-L)+R
840 IFR>QTHENLETQ=R
845 NEXTI
850 LETQ=B(13)-B(6)-Q:IFC>8THEN875
855 LETK=J:IFK>6THENK=K-7
860 FORI=0TON-1:IFF(N)*6+K=INT(F(I)/6^(7-C)+.1)THENLETQ=Q-2
870 NEXTI
875 FORI=0TO13:LETB(I)=G(I):NEXTI
880 IFQ>=DTHENLETA=J:LETD=Q
885 NEXTJ
890 LETM=A:PRINTCHR$(42+M);:GOTO200
900 FORI=0TON-1:PRINTB(I):NEXTI
999 END

68
dec/EVEN1.BAS Normal file
View File

@ -0,0 +1,68 @@
1 PRINT "GAME OF EVEN WINS - CYBERNETIC VERSION":PRINT
2 INPUT "DO YOU WANT INSTRUCTIONS (YES OR NO)";A$
3 IF A$="NO" THEN 19
4 PRINT:PRINT "THE GAME IS PLAYED AS FOLLOWS:"
5 PRINT "AT THE BEGINNING OF A GAME, A RANDOM NUMBER OF CHIPS ARE"
6 PRINT "PLACED ON THE BOARD. THE NUMBER OF CHIPS ALWAYS STARTS"
7 PRINT "AS AN ODD NUMBER. ON EACH TURN, A PLAYER MUST TAKE ONE,"
8 PRINT "TWO, THREE, OR FOUR CHIPS. THE WINNER IS THE PLAYER WHO"
9 PRINT "FINISHES WITH A TOTAL NUMBER OF CHIPS THAT IS EVEN."
10 PRINT "THE COMPUTER STARTS OUT KNOWING ONLY THE RULES OF THE"
11 PRINT "GAME. IT GRADUALLY LEARNS TO PLAY WELL. IT SHOULD BE"
12 PRINT "DIFFICULT TO BEAT THE COMPUTER TWENTY GAMES IN A ROW."
13 PRINT "TRY IT!!!":PRINT
14 PRINT "TO QUIT AT ANY TIME, TYPE A '0' AS YOUR MOVE.":PRINT
20 DIM R(1,5):RANDOMIZE
25 L=0:E=0
30 FOR I=0 TO 5
40 R(1,I)=4
50 R(0,I)=4
60 NEXT I
70 A=0:B=0
90 P=INT((13*RND+9)/2)*2+1
100 IF P=1 THEN 530
110 PRINT "THERE ARE"P"CHIPS ON THE BOARD."
120 E1=E
130 L1=L
140 E=(A/2-INT(A/2))*2
150 L=INT((P/6-INT(P/6))*6+.5)
160 IF R(E,L)>=P THEN 320
170 M=R(E,L)
180 IF M<=0 THEN 370
190 P=P-M
200 IF M=1 THEN 510
210 PRINT "COMPUTER TAKES"M"CHIPS LEAVING"P" ...YOUR MOVE";
220 B=B+M
230 INPUT M
240 M=INT(M)
250 IF M<1 THEN 450
260 IF M>4 THEN 460
270 IF M>P THEN 460
280 IF M=P THEN 360
290 P=P-M
300 A=A+M
310 GOTO 100
320 IF P=1 THEN 550
330 PRINT "COMPUTER TAKES"P"CHIPS"
340 R(E,L)=P
350 B=B+P
360 IF B/2=INT(B/2) THEN 420
370 PRINT "GAME OVER ... YOU WIN!!":PRINT
390 IF R(E,L)=1 THEN 480
400 R(E,L)=R(E,L)-1
410 GOTO 70
420 PRINT "GAME OVER ... I WIN!!!":PRINT
430 GOTO 70
450 IF M=0 THEN 570
460 PRINT M"IS AN ILLEGAL MOVE ... YOUR MOVE";
470 GOTO 230
480 IF R(E1,L1)=1 THEN 70
490 R(E1,L1)=R(E1,L1)-1
500 GOTO 70
510 PRINT "COMPUTER TAKES 1 CHIP LEAVING"P" ... YOUR MOVE";
520 GOTO 220
530 PRINT "THERE IS 1 CHIP ON THE BOARD"
540 GOTO 120
550 PRINT "COMPUTER TAKES 1 CHIP"
560 GOTO 340
570 END

56
dec/REVRSE.BAS Normal file
View File

@ -0,0 +1,56 @@
100 PRINT\PRINT "REVERSE -- A GAME OF SKILL"\PRINT
120 RANDOMIZE
130 DIM A(20)
140 REM *** N=NUMBER OF NUMBERS
150 N=9
160 INPUT "DO YOU WANT THE RULES (YES OR NO)";A$
180 IF A$="NO" THEN 210
190 GOSUB 710
200 REM *** MAKE A RANDOM LIST A(1) TO A(N)
210 A(1)=INT((N-1)*RND)+2
220 FOR K=2 TO N
230 A(K)=INT(N*RND)+1
240 FOR J=1 TO K-1
250 IF A(K)=A(J) THEN 230
260 NEXT J\NEXT K
280 REM *** PRINT ORIGINAL LIST AND START GAME
290 PRINT\PRINT "HERE WE GO ... THE LIST IS:"
310 T=0
320 GOSUB 610
330 INPUT "HOW MANY SHALL I REVERSE";R
350 IF R=0 THEN 520
360 IF R<=N THEN 390
370 PRINT "OOPS! TOO MANY - I CAN REVERSE AT MOST";N\GOTO 330
390 T=T+1
400 REM *** REVERSE R NUMBERS AND PRINT NEW LIST
410 FOR K=1 TO INT(R/2)
420 Z=A(K)
430 A(K)=A(R-K+1)
440 A(R-K+1)=Z
450 NEXT K
460 GOSUB 610
470 REM *** CHECK FOR A WIN
480 FOR K=1 TO N
490 IF A(K)<>K THEN 330
500 NEXT K
510 PRINT "YOU WON IT IN"T"MOVES !!!"\PRINT
530 INPUT "TRY AGAIN (YES OR NO)";A$
550 IF A$="YES" THEN 210
560 PRINT\PRINT "O.K. HOPE YOU HAD FUN!!"\GOTO 999
600 REM *** SUBROUTINE TO PRINT LIST
610 PRINT\FOR K=1 TO N\PRINT A(K);\NEXT K
650 PRINT\PRINT\RETURN
700 REM *** SUBROUTINE TO PRINT THE RULES
710 PRINT\PRINT "THIS IS THE GAME OF 'REVERSE'. TO WIN, ALL YOU HAVE"
720 PRINT "TO DO IS ARRANGE A LIST OF NUMBERS (1 THROUGH"N")"
730 PRINT "IN NUMERICAL ORDER FROM LEFT TO RIGHT. TO MOVE, YOU"
740 PRINT "TELL ME HOW MANY NUMBERS (COUNTING FROM THE LEFT) TO"
750 PRINT "REVERSE. FOR EXAMPLE, IF THE CURRENT LIST IS:"
760 PRINT\PRINT "2 3 4 5 1 6 7 8 9"
770 PRINT\PRINT "AND YOU REVERSE 4, THE RESULT WILL BE:"
780 PRINT\PRINT "5 4 3 2 1 6 7 8 9"
790 PRINT\PRINT "NOW IF YOU REVERSE 5, YOU WIN!"
800 PRINT\PRINT "1 2 3 4 5 6 7 8 9"\PRINT
810 PRINT "NO DOUBT YOU WILL LIKE THIS GAME OF SKILL, BUT"
820 PRINT "IF YOU WANT TO QUIT, REVERSE 0 (ZERO)."\PRINT\RETURN
999 END

35
dec/ROCKET.BAS Normal file
View File

@ -0,0 +1,35 @@
2 PRINT "THIS IS A COMPUTER SIMULATION OF AN APOLLO LUNAR"
3 PRINT "LANDING CAPSULE."\PRINT\PRINT
4 PRINT "THE ON-BOARD COMPUTER HAS FAILED (IT WASN'T MADE BY"
5 PRINT "DIGITAL) SO YOU HAVE TO LAND THE CAPSULE MANUALLY"
6 PRINT\PRINT "SET BURN RATE OF RETRO ROCKETS TO ANY VALUE BETWEEN"
7 PRINT "0 (FREE FALL) AND 200 (MAXIMUM BURN) POUNDS PER SECOND"
8 PRINT "SET NEW BURN RATE EVERY 10 SECONDS."\PRINT
9 PRINT "CAPSULE WEIGHT 32,500 LBS; FUEL WEIGHT 16,500 LBS"
10 PRINT\PRINT\PRINT "GOOD LUCK!!!"
11 L=0
13 PRINT\PRINT "SEC","MI + FT","MPH","LB FUEL","BURN RATE"\PRINT
15 A=120\V=1\M=33000\N=16500\G=1E-03\Z=1.8
21 PRINT L,INT(A);INT(5280*(A-INT(A))),3600*V,M-N,\INPUT K\T=10
31 IF M-N<.001 THEN 41\IF T<.001 THEN 21\S=T\IF M>=N+S*K THEN 35
32 S=(M-N)/K
35 GOSUB 91\IF I<=0 THEN 71\IF V<=0 THEN 38\IF J<0 THEN 81
38 GOSUB 61\GOTO 31
41 PRINT "FUEL OUT AT"L"SEC"\S=(-V+SQR(V*V+2*A*G))/G\V=V+G*S\L=L+S
51 W=3600*V\PRINT "ON MOON AT"L"SEC - IMPACT VELOCITY" W "MPH"
52 IF W>1.2 THEN 53\PRINT "PERFECT LANDING! (LUCKY)"\GOTO 95
53 IF W>10 THEN 56\PRINT "GOOD LANDING (COULD BE BETTER)"\GOTO 95
56 IF W>60 THEN 58 \PRINT "CRAFT DAMAGE.....YOU'RE STRANDED HERE UNTIL"
57 PRINT "A RESCUE PARTY ARRIVES. HOPE YOU HAVE ENOUGH OXYGEN!"\GOTO 95
58 PRINT "SORRY, BUT THERE WERE NO SURVIVORS...YOU BLEW IT!"
59 PRINT "IN FACT, YOU BLASTED A NEW LUNAR CRATER"W*.227"FT DEEP"
60 GOTO 95
61 L=L+S\T=T-S\M=M-S*K\A=I\V=J\RETURN
71 IF S<5E-03 THEN 51\D=V+SQR(V*V+2*A*(G-Z*K/M))\S=2*A/D
73 GOSUB 91\GOSUB 61\GOTO 71
81 W=(1-M*G/(Z*K))/2\S=M*V/(Z*K*(W+SQR(W*W+V/Z)))+.05\GOSUB 91
83 IF I<=0 THEN 71\GOSUB 61\IF J>0 THEN 31\IF V>0 THEN 81\GOTO 31
91 Q=S*K/M\J=V+G*S+Z*(-Q-Q*Q/2-Q^3/3-Q^4/4-Q^5/5)
94 I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30)\RETURN
95 PRINT\PRINT\PRINT\PRINT "TRY AGAIN??"\GOTO 6
99 END

66
dec/WAR.BAS Normal file
View File

@ -0,0 +1,66 @@
1 REM THIS PROGRAM PLAYS THE CARD GAME OF WAR. THE ONLY CHANGE
2 REM IS THAT A TIE MAKES NO SCORE AT ALL. THE PACK IS READ IN
3 REM AND THEN SHUFFLES IN A RANDOM WAY. THE COMPUTER THEN DEALS THE
4 REM CARDS TWO AT A TIME AS LONG AS THE GAME CONTINUES. A RUNNING
5 REM SCORE IS KEPT.
100 PRINT "THIS IS THE CARD GAME OF WAR. EACH CARD IS GIVEN BY SUIT-#";
110 PRINT "AS S-7 FOR SPADE 7. ";
120 PRINT "DO YOU WANT DIRECTIONS";
130 INPUT B$
140 IF B$="NO" THEN 210
150 IF B$="YES" THEN 180
160 PRINT "YES OR NO, PLEASE. ";
170 GOTO 120
180 PRINT "THE COMPUTER GIVES YOU AND IT A 'CARD'. THE HIGHER 'CARD' ";
190 PRINT "(NUMERICALLY) WINS. THE GAME ENDS WHEN YOU CHOOSE NOT";
200 PRINT " TO CONTINUE OR WHEN YOU HAVE FINISHED THE PACK."
210 PRINT
220 PRINT
230 DIM A$(52), L(54)
240 FOR I=1 TO 52
250 READ A$(I)
260 NEXT I
270 RANDOM
280 FOR J=1 TO 52
290 LET L(J)=INT(52*RND(X)+1)
300 FOR K=1 TO J-1
310 IF L(K)<>L(J) THEN 340
320 LET J=J-1
330 GOTO 350
340 NEXT K
350 NEXT J
360 LET P=P+1
370 LET M1=L(P)
380 LET P=P+1
390 LET M2=L(P)
400 PRINT
410 PRINT
420 PRINT "YOU: ";A$(M1), "COMPUTER: ";A$(M2),
430 LET N1=INT((M1-.5)/4)
440 LET N2=INT((M2-.5)/4)
450 IF N1>=N2 THEN 490
460 LET A1=A1+1
470 PRINT "COMPUTER WINS.^G^G^G^G^G YOU HAVE";B1;"; COMPUTER HAS";A1
480 GOTO 540
490 IF N1=N2 THEN 530
500 LET B1=B1+1
510 PRINT "YOU WIN. YOU HAVE";B1;"; COMPUTER HAS";A1
520 GOTO 540
530 PRINT "TIE. NO SCORE CHANGE."
540 IF L(P+1)=0. THEN 610
550 PRINT "DO YOU WANT TO CONTINUE";
560 INPUT V$
570 IF V$="YES" THEN 360
580 IF V$="NO" THEN 650
590 PRINT "YES OR NO, PLEASE. ";
600 GOTO 540
610 PRINT
620 PRINT
630 PRINT "YOU HAVE RUN OUT OF CARDS. FINAL SCORE: YOU--";B1;
640 PRINT "; COMPUTER--";A1
650 PRINT "THANKS FOR PLAYING. IT WAS FUN.^G^G"
660 DATA S-2,H-2,C-2,D-2,S-3,H-3,C-3,D-3,S-4,H-4,C-4,D-4,S-5,H-5,C-5
670 DATA D-5,S-6,H-6,C-6,D-6,S-7,H-7,C-7,D-7,S-8,H-8,C-8,D-8,S-9,H-9
680 DATA C-9,D-9,S-10,H-10,C-10,D-10,S-J,H-J,C-J,D-J,S-Q,H-Q,C-Q,D-Q
690 DATA S-K,H-K,C-K,D-K,S-A,H-A,C-A,D-A
700 END

69
port/AWARI.BAS Normal file
View File

@ -0,0 +1,69 @@
5 DATA0
10 DIMB(13),G(13),F(50)\READN
15 FORI=0TON-1\READF(I)\NEXTI
20 PRINT\PRINT "GAME OF *** AWARI ***"\E=0
25 FORI=0TO12\LETB(I)=3\NEXTI
30 LETC=0\LETF(N)=0\LETB(13)=0\LETB(6)=0
35 GOSUB 500
40 PRINT"YOUR MOVE";\GOSUB 110
45 IFE=0GOTO80
50 IFM<>HTHEN55\GOSUB100
55 IFE=0GOTO80
60 PRINT"MY MOVE IS ";\GOSUB800
65 IFE=0GOTO80
70 IFM<>HTHEN75\PRINT",";\GOSUB800
75 IFE>0GOTO35
80 PRINT\PRINT"GAME OVER"
85 LET D=B(6)-B(13)\IF D>=0 THEN 90\PRINT "I WIN BY";-D"POINTS"\GOTO 20
90 LETN=N+1\IFD<>0THEN95\PRINT"DRAWN GAME"\GOTO 20
95 PRINT"YOU WIN BY"D"POINTS"\GOTO20
100 PRINT "AGAIN";
110 INPUTM\IFM>=7THEN120\IFM<=0THEN120\LETM=M-1\GOTO130
120 PRINT"ILLEGAL MOVE"\GOTO100
130 IFB(M)=0GOTO120
140 LETH=6\GOSUB200
150 GOTO500
200 LETK=M\GOSUB600
205 LETE=0\IFK<=6THEN210\K=K-7
210 LETC=C+1\IFC>=9THEN215\LETF(N)=F(N)*6+K
215 FORI=0TO5\IFB(I)<>0THEN230
220 NEXTI
225 RETURN
230 FORI=7TO12\IFB(I)=0THEN235\LETE=1\RETURN
235 NEXTI\RETURN
500 PRINT\PRINT" ";
505 FORI=12TO7STEP-1\GOSUB580
510 NEXTI
515 PRINT\LETI=13\GOSUB580
520 PRINT" "," ";\PRINTB(6)\PRINT" ";
525 FORI=0TO5\GOSUB580
530 NEXTI
535 PRINT\PRINT\RETURN
580 IFB(I)>=10THEN585\PRINT" ";
585 PRINTB(I);\RETURN
600 LETP=B(M)\LETB(M)=0
605 FORP=PTO1STEP-1\LETM=M+1\IFM<=13THEN610\LETM=M-14
610 LETB(M)=B(M)+1\NEXTP
615 IFB(M)<>1THEN620\IFM=6THEN620\IFM=13THEN620\IFB(12-M)<>0GOTO625
620 RETURN
625 LETB(H)=B(H)+B(12-M)+1\LETB(M)=0\LETB(12-M)=0\RETURN
800 LETD=-99\LETH=13
805 FORI=0TO13\LETG(I)=B(I)\NEXTI
810 FORJ=7TO12\IFB(J)=0THEN885
815 LETQ=0\LETM=J\GOSUB600
820 FORI=0TO5\IFB(I)=0THEN845
825 LETL=B(I)+I\LETR=0
830 IFL<=13THEN835\LETL=L-14\LETR=1\GOTO830
835 IFB(L)<>0THEN840\IFL=6THEN840\IFL=13THEN840\LETR=B(12-L)+R
840 IFR<=QTHEN845\LETQ=R
845 NEXTI
850 LETQ=B(13)-B(6)-Q\IFC>8THEN875
855 LETK=J\IFK<=6THEN860\K=K-7
860 FORI=0TON-1\IFF(N)*6+K<>INT(F(I)/6^(7-C)+.1)THEN870\LETQ=Q-2
870 NEXTI
875 FORI=0TO13\LETB(I)=G(I)\NEXTI
880 IFQ<DTHEN885\LETA=J\LETD=Q
885 NEXTJ
890 LETM=A\PRINTCHR$(42+M);\GOTO200
900 FORI=0TON-1\PRINTB(I)\NEXTI
999 END

68
port/EVEN1.BAS Normal file
View File

@ -0,0 +1,68 @@
1 PRINT "GAME OF EVEN WINS - CYBERNETIC VERSION"\PRINT
2 PRINT "DO YOU WANT INSTRUCTIONS (YES OR NO)";\INPUT A$
3 IF A$="NO" THEN 20
4 PRINT\PRINT "THE GAME IS PLAYED AS FOLLOWS:"
5 PRINT "AT THE BEGINNING OF A GAME, A RANDOM NUMBER OF CHIPS ARE"
6 PRINT "PLACED ON THE BOARD. THE NUMBER OF CHIPS ALWAYS STARTS"
7 PRINT "AS AN ODD NUMBER. ON EACH TURN, A PLAYER MUST TAKE ONE,"
8 PRINT "TWO, THREE, OR FOUR CHIPS. THE WINNER IS THE PLAYER WHO"
9 PRINT "FINISHES WITH A TOTAL NUMBER OF CHIPS THAT IS EVEN."
10 PRINT "THE COMPUTER STARTS OUT KNOWING ONLY THE RULES OF THE"
11 PRINT "GAME. IT GRADUALLY LEARNS TO PLAY WELL. IT SHOULD BE"
12 PRINT "DIFFICULT TO BEAT THE COMPUTER TWENTY GAMES IN A ROW."
13 PRINT "TRY IT!!!"\PRINT
14 PRINT "TO QUIT AT ANY TIME, TYPE A '0' AS YOUR MOVE."\PRINT
20 DIM R(1,5)\RANDOMIZE
25 L=0\E=0
30 FOR I=0 TO 5
40 R(1,I)=4
50 R(0,I)=4
60 NEXT I
70 A=0\B=0
90 P=INT((13*RND(1)+9)/2)*2+1
100 IF P=1 THEN 530
110 PRINT "THERE ARE"P"CHIPS ON THE BOARD."
120 E1=E
130 L1=L
140 E=(A/2-INT(A/2))*2
150 L=INT((P/6-INT(P/6))*6+.5)
160 IF R(E,L)>=P THEN 320
170 M=R(E,L)
180 IF M<=0 THEN 370
190 P=P-M
200 IF M=1 THEN 510
210 PRINT "COMPUTER TAKES"M"CHIPS LEAVING"P" ...YOUR MOVE";
220 B=B+M
230 INPUT M
240 M=INT(M)
250 IF M<1 THEN 450
260 IF M>4 THEN 460
270 IF M>P THEN 460
280 IF M=P THEN 360
290 P=P-M
300 A=A+M
310 GOTO 100
320 IF P=1 THEN 550
330 PRINT "COMPUTER TAKES"P"CHIPS"
340 R(E,L)=P
350 B=B+P
360 IF B/2=INT(B/2) THEN 420
370 PRINT "GAME OVER ... YOU WIN!!"\PRINT
390 IF R(E,L)=1 THEN 480
400 R(E,L)=R(E,L)-1
410 GOTO 70
420 PRINT "GAME OVER ... I WIN!!!"\PRINT
430 GOTO 70
450 IF M=0 THEN 570
460 PRINT M"IS AN ILLEGAL MOVE ... YOUR MOVE";
470 GOTO 230
480 IF R(E1,L1)=1 THEN 70
490 R(E1,L1)=R(E1,L1)-1
500 GOTO 70
510 PRINT "COMPUTER TAKES 1 CHIP LEAVING"P" ... YOUR MOVE";
520 GOTO 220
530 PRINT "THERE IS 1 CHIP ON THE BOARD"
540 GOTO 120
550 PRINT "COMPUTER TAKES 1 CHIP"
560 GOTO 340
570 END

59
port/REVRSE.BAS Normal file
View File

@ -0,0 +1,59 @@
100 PRINT\PRINT "REVERSE -- A GAME OF SKILL"\PRINT
120 RANDOMIZE
130 DIM A(20)
140 REM *** N=NUMBER OF NUMBERS
150 N=9
160 PRINT "DO YOU WANT THE RULES (YES OR NO)";
170 INPUT A$
180 IF A$="NO" THEN 210
190 GOSUB 710
200 REM *** MAKE A RANDOM LIST A(1) TO A(N)
210 A(1)=INT((N-1)*RND(1))+2
220 FOR K=2 TO N
230 A(K)=INT(N*RND(1))+1
240 FOR J=1 TO K-1
250 IF A(K)=A(J) THEN 230
260 NEXT J\NEXT K
280 REM *** PRINT ORIGINAL LIST AND START GAME
290 PRINT\PRINT "HERE WE GO ... THE LIST IS:"
310 T=0
320 GOSUB 610
330 PRINT "HOW MANY SHALL I REVERSE";
340 INPUT R
350 IF R=0 THEN 530
360 IF R<=N THEN 390
370 PRINT "OOPS! TOO MANY - I CAN REVERSE AT MOST";N\GOTO 330
390 T=T+1
400 REM *** REVERSE R NUMBERS AND PRINT NEW LIST
410 FOR K=1 TO INT(R/2)
420 Z=A(K)
430 A(K)=A(R-K+1)
440 A(R-K+1)=Z
450 NEXT K
460 GOSUB 610
470 REM *** CHECK FOR A WIN
480 FOR K=1 TO N
490 IF A(K)<>K THEN 330
500 NEXT K
510 PRINT "YOU WON IT IN"T"MOVES !!!"\PRINT
530 PRINT "TRY AGAIN (YES OR NO)";
540 INPUT A$
550 IF A$="YES" THEN 210
560 PRINT\PRINT "O.K. HOPE YOU HAD FUN!!"\GOTO 999
600 REM *** SUBROUTINE TO PRINT LIST
610 PRINT\FOR K=1 TO N\PRINT A(K);\NEXT K
650 PRINT\PRINT\RETURN
700 REM *** SUBROUTINE TO PRINT THE RULES
710 PRINT\PRINT "THIS IS THE GAME OF 'REVERSE'. TO WIN, ALL YOU HAVE"
720 PRINT "TO DO IS ARRANGE A LIST OF NUMBERS (1 THROUGH"N")"
730 PRINT "IN NUMERICAL ORDER FROM LEFT TO RIGHT. TO MOVE, YOU"
740 PRINT "TELL ME HOW MANY NUMBERS (COUNTING FROM THE LEFT) TO"
750 PRINT "REVERSE. FOR EXAMPLE, IF THE CURRENT LIST IS:"
760 PRINT\PRINT "2 3 4 5 1 6 7 8 9"
770 PRINT\PRINT "AND YOU REVERSE 4, THE RESULT WILL BE:"
780 PRINT\PRINT "5 4 3 2 1 6 7 8 9"
790 PRINT\PRINT "NOW IF YOU REVERSE 5, YOU WIN!"
800 PRINT\PRINT "1 2 3 4 5 6 7 8 9"\PRINT
810 PRINT "NO DOUBT YOU WILL LIKE THIS GAME OF SKILL, BUT"
820 PRINT "IF YOU WANT TO QUIT, REVERSE 0 (ZERO)."\PRINT\RETURN
999 END

35
port/ROCKET.BAS Normal file
View File

@ -0,0 +1,35 @@
2 PRINT "THIS IS A COMPUTER SIMULATION OF AN APOLLO LUNAR"
3 PRINT "LANDING CAPSULE."\PRINT\PRINT
4 PRINT "THE ON-BOARD COMPUTER HAS FAILED (IT WASN'T MADE BY"
5 PRINT "DIGITAL) SO YOU HAVE TO LAND THE CAPSULE MANUALLY"
6 PRINT\PRINT "SET BURN RATE OF RETRO ROCKETS TO ANY VALUE BETWEEN"
7 PRINT "0 (FREE FALL) AND 200 (MAXIMUM BURN) POUNDS PER SECOND"
8 PRINT "SET NEW BURN RATE EVERY 10 SECONDS."\PRINT
9 PRINT "CAPSULE WEIGHT 32,500 LBS; FUEL WEIGHT 16,500 LBS"
10 PRINT\PRINT\PRINT "GOOD LUCK!!!"
11 L=0
13 PRINT\PRINT "SEC","MI + FT","MPH","LB FUEL","BURN RATE"\PRINT
15 A=120\V=1\M=33000\N=16500\G=1E-03\Z=1.8
21 PRINT L,INT(A);INT(5280*(A-INT(A))),3600*V,M-N,\INPUT K\T=10
31 IF M-N<.001 THEN 41\IF T<.001 THEN 21\S=T\IF M>=N+S*K THEN 35
32 S=(M-N)/K
35 GOSUB 91\IF I<=0 THEN 71\IF V<=0 THEN 38\IF J<0 THEN 81
38 GOSUB 61\GOTO 31
41 PRINT "FUEL OUT AT"L"SEC"\S=(-V+SQR(V*V+2*A*G))/G\V=V+G*S\L=L+S
51 W=3600*V\PRINT "ON MOON AT"L"SEC - IMPACT VELOCITY" W "MPH"
52 IF W>1.2 THEN 53\PRINT "PERFECT LANDING! (LUCKY)"\GOTO 95
53 IF W>10 THEN 56\PRINT "GOOD LANDING (COULD BE BETTER)"\GOTO 95
56 IF W>60 THEN 58 \PRINT "CRAFT DAMAGE.....YOU'RE STRANDED HERE UNTIL"
57 PRINT "A RESCUE PARTY ARRIVES. HOPE YOU HAVE ENOUGH OXYGEN!"\GOTO 95
58 PRINT "SORRY, BUT THERE WERE NO SURVIVORS...YOU BLEW IT!"
59 PRINT "IN FACT, YOU BLASTED A NEW LUNAR CRATER"W*.227"FT DEEP"
60 GOTO 95
61 L=L+S\T=T-S\M=M-S*K\A=I\V=J\RETURN
71 IF S<5E-03 THEN 51\D=V+SQR(V*V+2*A*(G-Z*K/M))\S=2*A/D
73 GOSUB 91\GOSUB 61\GOTO 71
81 W=(1-M*G/(Z*K))/2\S=M*V/(Z*K*(W+SQR(W*W+V/Z)))+.05\GOSUB 91
83 IF I<=0 THEN 71\GOSUB 61\IF J>0 THEN 31\IF V>0 THEN 81\GOTO 31
91 Q=S*K/M\J=V+G*S+Z*(-Q-Q*Q/2-Q^3/3-Q^4/4-Q^5/5)
94 I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30)\RETURN
95 PRINT\PRINT\PRINT\PRINT "TRY AGAIN??"\GOTO 6
99 END

69
port/WAR.BAS Normal file
View File

@ -0,0 +1,69 @@
1 REM THIS PROGRAM PLAYS THE CARD GAME OF WAR. THE ONLY CHANGE
2 REM IS THAT A TIE MAKES NO SCORE AT ALL. THE PACK IS READ IN
3 REM AND THEN SHUFFLES IN A RANDOM WAY. THE COMPUTER THEN DEALS THE
4 REM CARDS TWO AT A TIME AS LONG AS THE GAME CONTINUES. A RUNNING
5 REM SCORE IS KEPT.
100 PRINT "THIS IS THE CARD GAME OF WAR. EACH CARD IS GIVEN BY SUIT-#";
110 PRINT "AS S-7 FOR SPADE 7. ";
120 PRINT "DO YOU WANT DIRECTIONS";
130 INPUT B$
140 IF B$="NO" THEN 210
150 IF B$="YES" THEN 180
160 PRINT "YES OR NO, PLEASE. ";
170 GOTO 120
180 PRINT "THE COMPUTER GIVES YOU AND IT A 'CARD'. THE HIGHER 'CARD' ";
190 PRINT "(NUMERICALLY) WINS. THE GAME ENDS WHEN YOU CHOOSE NOT";
200 PRINT " TO CONTINUE OR WHEN YOU HAVE FINISHED THE PACK."
210 PRINT
220 PRINT
230 DIM A$(52), L(54)
240 FOR I=1 TO 52
250 READ A$(I)
260 NEXT I
270 RANDOM
280 FOR J=1 TO 52
290 LET L(J)=INT(52*RND(X)+1)
300 FOR K=1 TO J-1
310 IF L(K)<>L(J) THEN 340
320 LET J=J-1
330 GOTO 350
340 NEXT K
350 NEXT J
360 LET P=P+1
370 LET M1=L(P)
380 LET P=P+1
390 LET M2=L(P)
400 PRINT
410 PRINT
420 PRINT "YOU: ";A$(M1), "COMPUTER: ";A$(M2),
430 LET N1=INT((M1-.5)/4)
440 LET N2=INT((M2-.5)/4)
450 IF N1>=N2 THEN 490
460 LET A1=A1+1
470 PRINT "COMPUTER WINS.";CHR$(7);" YOU HAVE";B1;"; COMPUTER HAS";A1
480 GOTO 540
490 IF N1=N2 THEN 530
500 LET B1=B1+1
510 PRINT "YOU WIN. YOU HAVE";B1;"; COMPUTER HAS";A1
520 GOTO 540
530 PRINT "TIE. NO SCORE CHANGE."
540 IF L(P+1)=0. THEN 610
550 PRINT "DO YOU WANT TO CONTINUE";
560 INPUT V$
570 IF V$="YES" THEN 360
580 IF V$="NO" THEN 650
590 PRINT "YES OR NO, PLEASE. ";
600 GOTO 540
610 PRINT
620 PRINT
630 PRINT "YOU HAVE RUN OUT OF CARDS. FINAL SCORE: YOU--";B1;
640 PRINT "; COMPUTER--";A1
650 PRINT "THANKS FOR PLAYING. IT WAS FUN.";CHR$(7);CHR$(7)
660 DATA "S-2","H-2","C-2","D-2","S-3","H-3","C-3","D-3","S-4","H-4","C-4"
665 DATA "D-4","S-5","H-5","C-5"
670 DATA "D-5","S-6","H-6","C-6","D-6","S-7","H-7","C-7","D-7","S-8","H-8"
675 DATA "C-8","D-8","S-9","H-9"
680 DATA "C-9","D-9","S-10","H-10","C-10","D-10","S-J","H-J","C-J","D-J"
685 DATA "S-Q","H-Q","C-Q","D-Q"
690 DATA "S-K","H-K","C-K","D-K","S-A","H-A","C-A","D-A"
700 END