mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-20 17:16:23 -05:00
Add 23MTCH, 3DPLOT, TRAIN and TRAP.
This commit is contained in:
parent
9f63035c8e
commit
1d798092c1
44
dec/23MTCH.BAS
Normal file
44
dec/23MTCH.BAS
Normal file
@ -0,0 +1,44 @@
|
||||
100 REM ***23 MATCHES
|
||||
110 PRINT "LET'S PLAY 23 MATCHES. WE START WITH 23 MATCHES."
|
||||
115 PRINT "YOU MOVE FIRST. YOU MAY TAKE 1,2 OR 3 MATCHES."
|
||||
120 PRINT "THEN I MOVE...I MAY TAKE 1,2 OR 3 MATCHES."
|
||||
125 PRINT "YOU MOVE, I MOVE AND SO ON. THE ONE WHO HAS TO"
|
||||
130 PRINT "TAKE THE LAST MATCH LOSES."
|
||||
135 PRINT "GOOD LUCK AND MAY THE BEST COMPUTER (HA HA) WIN."
|
||||
140 PRINT
|
||||
150 LET M=23
|
||||
200 REM ***THE HUMAN MOVES
|
||||
205 PRINT
|
||||
210 PRINT "THERE ARE NOW";M;"MATCHES."
|
||||
215 PRINT
|
||||
220 PRINT "HOW MANY DO YOU TAKE";
|
||||
230 INPUT H
|
||||
240 IF H>M THEN 510
|
||||
250 IF H<>INT(H) THEN 510
|
||||
260 IF H<=0 THEN 510
|
||||
270 IF H>=4 THEN 510
|
||||
280 LET M=M-H
|
||||
290 IF M=0 THEN 410
|
||||
300 REM ***THE COMPUTER MOVES
|
||||
305 IF M=1 THEN 440
|
||||
310 LET R=M-4*INT(M/4)
|
||||
320 IF R<>1 THEN 350
|
||||
330 LET C=INT(3*RND(0))+1
|
||||
340 GO TO 360
|
||||
350 LET C=(R+3)-4*INT((R+3)/4)
|
||||
360 LET M=M-C
|
||||
370 IF M=0 THEN 440
|
||||
375 PRINT
|
||||
380 PRINT "I TOOK";C;"...";
|
||||
390 GO TO 210
|
||||
400 REM ***SOMEBODY WON (SEE LINES 290,305,370)
|
||||
410 PRINT
|
||||
420 PRINT "I WON!!! BETTER LUCK NEXT TIME."
|
||||
430 GO TO 140
|
||||
440 PRINT
|
||||
450 PRINT "O.K. SO YOU WON. LET'S PLAY AGAIN."
|
||||
460 GO TO 140
|
||||
500 REM ***THE HUMAN CHEATED! (SEE LINES 240 THRU 270)
|
||||
510 PRINT "YOU CHEATED! BUT I'LL GIVE YOU ANOTHER CHANCE."
|
||||
520 GO TO 215
|
||||
999 END
|
14
dec/3DPLOT.BAS
Normal file
14
dec/3DPLOT.BAS
Normal file
@ -0,0 +1,14 @@
|
||||
5 DEF FNA(Z)=30*EXP(-Z*Z/100)
|
||||
100 PRINT
|
||||
110 FOR X=-30 TO 30 STEP 1.5
|
||||
120 L=0
|
||||
130 Y1=5*INT(SQR(900-X*X)/5)
|
||||
140 FOR Y=Y1 TO -Y1 STEP -5
|
||||
150 Z=INT(25+FNA(SQR(X*X+Y*Y))-.7*Y)
|
||||
160 IF Z<=L THEN 190
|
||||
170 L=Z
|
||||
180 PRINT TAB(Z)"*";
|
||||
190 NEXT Y
|
||||
200 PRINT
|
||||
210 NEXTX
|
||||
300 END
|
21
dec/TRAIN.BAS
Normal file
21
dec/TRAIN.BAS
Normal file
@ -0,0 +1,21 @@
|
||||
4 PRINT "TIME - SPEED - DISTANCE EXERCISE"\PRINT
|
||||
5 RANDOMIZE
|
||||
10 C=INT(RND*25)+40
|
||||
15 D=INT(RND*15)+5
|
||||
20 T=INT(RND*19)+20
|
||||
25 PRINT " A CAR TRAVELING"C"MPH CAN MAKE A CERTAIN TRIP IN"
|
||||
30 PRINT D"HOURS LESS THAN A TRAIN TRAVELING AT"T"MPH."
|
||||
35 PRINT "HOW LONG DOES THE TRIP TAKE BY CAR";
|
||||
40 INPUT A
|
||||
45 V=D*T/(C-T)
|
||||
50 E=INT(ABS((V-A)*100/A)+.5)
|
||||
55 IF E>5 THEN 70
|
||||
60 PRINT "GOOD! ANSWER WITHIN"E"PERCENT."
|
||||
65 GOTO 80
|
||||
70 PRINT "SORRY. YOU WERE OFF BY"E"PERCENT."
|
||||
80 PRINT "CORRECT ANSWER IS"V"HOURS."
|
||||
90 PRINT
|
||||
95 PRINT "ANOTHER PROBLEM (YES OR NO)";
|
||||
100 INPUT A$\PRINT
|
||||
105 IF A$="YES" THEN 10
|
||||
999 END
|
46
dec/TRAP.BAS
Normal file
46
dec/TRAP.BAS
Normal file
@ -0,0 +1,46 @@
|
||||
10 G=6
|
||||
20 N=100
|
||||
30 REM-TRAP
|
||||
40 REM-STEVE ULLMAN, 8-1-72
|
||||
50 PRINT "WANT INSTRUCTIONS (1 FOR YES)";
|
||||
60 INPUT Z
|
||||
70 IF Z<>1 THEN 180
|
||||
80 PRINT "I AM THINKING OF A NUMBER BETWEEN 1 AND";N
|
||||
90 PRINT "TRY TO GUESS MY NUMBER. ON EACH GUESS,"
|
||||
100 PRINT "YOU ARE TO ENTER 2 NUMBERS, TRYING TO TRAP"
|
||||
110 PRINT "MY NUMBER BETWEEN THE TWO NUMBERS. I WILL"
|
||||
120 PRINT "TELL YOU IF YOU HAVE TRAPPED MY NUMBER, IF MY"
|
||||
130 PRINT "NUMBER IS LARGER THAN YOUR TWO NUMBERS, OR IF"
|
||||
140 PRINT "MY NUMBER IS SMALLER THAN YOUR TWO NUMBERS."
|
||||
150 PRINT "IF YOU WANT TO GUESS ONE SINGLE NUMBER, TYPE"
|
||||
160 PRINT "YOUR GUESS FOR BOTH YOUR TRAP NUMBERS."
|
||||
170 PRINT "YOU GET";G;"GUESSES TO GET MY NUMBER."
|
||||
180 X=INT(N*RND(0))+1
|
||||
190 FOR Q=1 TO G
|
||||
200 PRINT
|
||||
210 PRINT "GUESS #";Q;
|
||||
220 INPUT A,B
|
||||
230 IF A<>B THEN 240
|
||||
235 IF X=A THEN 400
|
||||
240 IF A <=B THEB 260
|
||||
250 GOSUB 360
|
||||
260 IF X<A THEN 300
|
||||
270 IF X<=B THEN 320
|
||||
280 PRINT "MY NUMBER IS LARGER THAN YOUR TRAP NUMBERS."
|
||||
290 GOTO 330
|
||||
300 PRINT "MY NUMBER IS SMALLER THAN YOUR TRAP NUMBERS."
|
||||
310 GOTO 330
|
||||
320 PRINT "YOU HAVE TRAPPED MY NUMBER."
|
||||
330 NEXTQ
|
||||
340 PRINT "SORRY, THAT'S";G;"GUESSES. NUMBER WAS";X
|
||||
350 GOTO 410
|
||||
360 R=A
|
||||
370 A=B
|
||||
380 B=R
|
||||
390 RETURN
|
||||
400 PRINT "YOU GOT IT!!!"
|
||||
410 PRINT
|
||||
420 PRINT "TRY AGAIN."
|
||||
430 PRINT
|
||||
440 GOTO 180
|
||||
450 END
|
45
port/23MTCH.BAS
Normal file
45
port/23MTCH.BAS
Normal file
@ -0,0 +1,45 @@
|
||||
100 REM ***23 MATCHES
|
||||
105 RANDOMIZE
|
||||
110 PRINT "LET'S PLAY 23 MATCHES. WE START WITH 23 MATCHES."
|
||||
115 PRINT "YOU MOVE FIRST. YOU MAY TAKE 1,2 OR 3 MATCHES."
|
||||
120 PRINT "THEN I MOVE...I MAY TAKE 1,2 OR 3 MATCHES."
|
||||
125 PRINT "YOU MOVE, I MOVE AND SO ON. THE ONE WHO HAS TO"
|
||||
130 PRINT "TAKE THE LAST MATCH LOSES."
|
||||
135 PRINT "GOOD LUCK AND MAY THE BEST COMPUTER (HA HA) WIN."
|
||||
140 PRINT
|
||||
150 LET M=23
|
||||
200 REM ***THE HUMAN MOVES
|
||||
205 PRINT
|
||||
210 PRINT "THERE ARE NOW";M;"MATCHES."
|
||||
215 PRINT
|
||||
220 PRINT "HOW MANY DO YOU TAKE";
|
||||
230 INPUT H
|
||||
240 IF H>M THEN 510
|
||||
250 IF H<>INT(H) THEN 510
|
||||
260 IF H<=0 THEN 510
|
||||
270 IF H>=4 THEN 510
|
||||
280 LET M=M-H
|
||||
290 IF M=0 THEN 410
|
||||
300 REM ***THE COMPUTER MOVES
|
||||
305 IF M=1 THEN 440
|
||||
310 LET R=M-4*INT(M/4)
|
||||
320 IF R<>1 THEN 350
|
||||
330 LET C=INT(3*RND(0))+1
|
||||
340 GO TO 360
|
||||
350 LET C=(R+3)-4*INT((R+3)/4)
|
||||
360 LET M=M-C
|
||||
370 IF M=0 THEN 440
|
||||
375 PRINT
|
||||
380 PRINT "I TOOK";C;"...";
|
||||
390 GO TO 210
|
||||
400 REM ***SOMEBODY WON (SEE LINES 290,305,370)
|
||||
410 PRINT
|
||||
420 PRINT "I WON!!! BETTER LUCK NEXT TIME."
|
||||
430 GO TO 140
|
||||
440 PRINT
|
||||
450 PRINT "O.K. SO YOU WON. LET'S PLAY AGAIN."
|
||||
460 GO TO 140
|
||||
500 REM ***THE HUMAN CHEATED! (SEE LINES 240 THRU 270)
|
||||
510 PRINT "YOU CHEATED! BUT I'LL GIVE YOU ANOTHER CHANCE."
|
||||
520 GO TO 215
|
||||
999 END
|
19
port/3DPLOT.BAS
Normal file
19
port/3DPLOT.BAS
Normal file
@ -0,0 +1,19 @@
|
||||
5 DEF FNA(Z)=30*EXP(-Z*Z/100)
|
||||
10 ' DEF FNA(Z)=SQR(900.01-Z*Z)*.9-2
|
||||
20 ' DEF FNA(Z)=30*(COS(Z/16))^2
|
||||
30 ' DEF FNA(Z)=30-30*SIN(Z/18)
|
||||
40 ' DEF FNA(Z)=30*EXP(-COS(Z/16))-30
|
||||
50 ' DEF FNA(Z)=30*SIN(Z/10)
|
||||
100 PRINT
|
||||
110 FOR X=-30 TO 30 STEP 1.5
|
||||
120 L=0
|
||||
130 Y1=5*INT(SQR(900-X*X)/5)
|
||||
140 FOR Y=Y1 TO -Y1 STEP -5
|
||||
150 Z=INT(25+FNA(SQR(X*X+Y*Y))-.7*Y)
|
||||
160 IF Z<=L THEN 190
|
||||
170 L=Z
|
||||
180 PRINT TAB(Z)"*";
|
||||
190 NEXT Y
|
||||
200 PRINT
|
||||
210 NEXTX
|
||||
300 END
|
21
port/TRAIN.BAS
Normal file
21
port/TRAIN.BAS
Normal file
@ -0,0 +1,21 @@
|
||||
4 PRINT "TIME - SPEED - DISTANCE EXERCISE"\PRINT
|
||||
5 RANDOMIZE
|
||||
10 C=INT(RND(1)*25)+40
|
||||
15 D=INT(RND(1)*15)+5
|
||||
20 T=INT(RND(1)*19)+20
|
||||
25 PRINT " A CAR TRAVELING"C"MPH CAN MAKE A CERTAIN TRIP IN"
|
||||
30 PRINT D"HOURS LESS THAN A TRAIN TRAVELING AT"T"MPH."
|
||||
35 PRINT "HOW LONG DOES THE TRIP TAKE BY CAR";
|
||||
40 INPUT A
|
||||
45 V=D*T/(C-T)
|
||||
50 E=INT(ABS((V-A)*100/A)+.5)
|
||||
55 IF E>5 THEN 70
|
||||
60 PRINT "GOOD! ANSWER WITHIN"E"PERCENT."
|
||||
65 GOTO 80
|
||||
70 PRINT "SORRY. YOU WERE OFF BY"E"PERCENT."
|
||||
80 PRINT "CORRECT ANSWER IS"V"HOURS."
|
||||
90 PRINT
|
||||
95 PRINT "ANOTHER PROBLEM (YES OR NO)";
|
||||
100 INPUT A$\PRINT
|
||||
105 IF A$="YES" THEN 10
|
||||
999 END
|
47
port/TRAP.BAS
Normal file
47
port/TRAP.BAS
Normal file
@ -0,0 +1,47 @@
|
||||
5 RANDOMIZE
|
||||
10 G=6
|
||||
20 N=100
|
||||
30 REM-TRAP
|
||||
40 REM-STEVE ULLMAN, 8-1-72
|
||||
50 PRINT "WANT INSTRUCTIONS (1 FOR YES)";
|
||||
60 INPUT Z
|
||||
70 IF Z<>1 THEN 180
|
||||
80 PRINT "I AM THINKING OF A NUMBER BETWEEN 1 AND";N
|
||||
90 PRINT "TRY TO GUESS MY NUMBER. ON EACH GUESS,"
|
||||
100 PRINT "YOU ARE TO ENTER 2 NUMBERS, TRYING TO TRAP"
|
||||
110 PRINT "MY NUMBER BETWEEN THE TWO NUMBERS. I WILL"
|
||||
120 PRINT "TELL YOU IF YOU HAVE TRAPPED MY NUMBER, IF MY"
|
||||
130 PRINT "NUMBER IS LARGER THAN YOUR TWO NUMBERS, OR IF"
|
||||
140 PRINT "MY NUMBER IS SMALLER THAN YOUR TWO NUMBERS."
|
||||
150 PRINT "IF YOU WANT TO GUESS ONE SINGLE NUMBER, TYPE"
|
||||
160 PRINT "YOUR GUESS FOR BOTH YOUR TRAP NUMBERS."
|
||||
170 PRINT "YOU GET";G;"GUESSES TO GET MY NUMBER."
|
||||
180 X=INT(N*RND(0))+1
|
||||
190 FOR Q=1 TO G
|
||||
200 PRINT
|
||||
210 PRINT "GUESS #";Q;
|
||||
220 INPUT A,B
|
||||
230 IF A<>B THEN 240
|
||||
235 IF X=A THEN 400
|
||||
240 IF A <=B THEB 260
|
||||
250 GOSUB 360
|
||||
260 IF X<A THEN 300
|
||||
270 IF X<=B THEN 320
|
||||
280 PRINT "MY NUMBER IS LARGER THAN YOUR TRAP NUMBERS."
|
||||
290 GOTO 330
|
||||
300 PRINT "MY NUMBER IS SMALLER THAN YOUR TRAP NUMBERS."
|
||||
310 GOTO 330
|
||||
320 PRINT "YOU HAVE TRAPPED MY NUMBER."
|
||||
330 NEXTQ
|
||||
340 PRINT "SORRY, THAT'S";G;"GUESSES. NUMBER WAS";X
|
||||
350 GOTO 410
|
||||
360 R=A
|
||||
370 A=B
|
||||
380 B=R
|
||||
390 RETURN
|
||||
400 PRINT "YOU GOT IT!!!"
|
||||
410 PRINT
|
||||
420 PRINT "TRY AGAIN."
|
||||
430 PRINT
|
||||
440 GOTO 180
|
||||
450 END
|
Loading…
Reference in New Issue
Block a user