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

Add BOUNCE, CHANGE and POET.

This commit is contained in:
Renaud 2024-05-07 10:05:30 +08:00
parent 529dcace19
commit c82fae17d8
6 changed files with 226 additions and 0 deletions

53
dec/BOUNCE.BAS Normal file
View File

@ -0,0 +1,53 @@
90 DIM T(20)
100 PRINT "THIS SIMULATION LETS YOU SPECIFY THE INITIAL VELOCITY"
110 PRINT "OF A BALL THROWN STRAIGHT UP, AND THE COEFFICIENT OF"
120 PRINT "ELASTICITY OF THE BALL. PLEASE USE A DECIMAL FRACTION"
130 PRINT "COEFFICIENT (LESS THAN 1)."
131 PRINT
132 PRINT "YOU ALSO SPECIFY THE TIME INCREMENT TO BE USED IN"
133 PRINT "'STROBING' THE BALL'S FLIGHT (TRY .1 INITIALLY)."
134 PRINT
135 PRINT "TIME INCREMENT (SEC)";
136 INPUT S2
140 PRINT
150 PRINT "VELOCITY (FPS)";
160 INPUT V
165 PRINT
170 PRINT "COEFFICIENT";
180 INPUT C
184 PRINT
185 PRINT "FEET"
186 PRINT
187 S1=INT(70/(V/(16*S2)))
190 FOR I=1 TO S1
200 T(I)=V*C^(I-1)/16
210 NEXT I
220 FOR H=INT(-16*(V/32)^2+V^2/32+.5) TO 0 STEP -.5
221 IF INT(H)<>H THEN 225
222 PRINT H;
225 L=0
230 FOR I=1 TO S1
240 FOR T=0 TO T(I) STEP S2
245 L=L+S2
250 IF ABS(H-(.5*(-32)*T^2+V*C^(I-1)*T))>.25 THEN 270
260 PRINT TAB(L/S2);"O";
270 NEXT T
275 T=T(I+1)/2
276 IF -16*T^2+V*C^(I-1)*T<H THEN 290
280 NEXT I
290 PRINT
300 NEXT H
310 PRINT TAB(1);
320 FOR I=1 TO INT(L+1)/S2+1
330 PRINT ".";
340 NEXT I
350 PRINT
355 PRINT " 0";
360 FOR I=1 TO INT(L+.9995)
380 PRINT TAB(INT(I/S2));I;
390 NEXT I
400 PRINT
410 PRINT TAB(INT(L+1)/(2*S2)-2);"SECONDS"
420 PRINT
430 GOTO 135
440 END

26
dec/CHANGE.BAS Normal file
View File

@ -0,0 +1,26 @@
2 PRINT "I, YOUR FRIENDLY EDUSYSTEM COMPUTER, WILL DETERMINE"
3 PRINT "THE CORRECT CHANGE FOR ITEMS COSTING UP TO $100."
4 PRINT\PRINT
10 PRINT "COST OF ITEM";\INPUT A\PRINT "AMOUNT OF PAYMENT";\INPUT P
20 C=P-A\M=C\IF C<>0 THEN 90 \PRINT "CORRECT AMOUNT,THANK YOU"
30 GO TO 10
90 IF C>0 THEN 120 \PRINT "SORRY,YOU HAVE SHORT CHANGED ME $";A-P
100 GO TO 10
120 PRINT "YOUR CHANGE,$";C\D=INT(C/10)\IF D=0 THEN 155
150 PRINT D;"TEN DOLLAR BILL(S)"
155 C=M-(D*10)\E=INT(C/5)\IF E=0 THEN 185
180 PRINT E;"FIVE DOLLARS BILL(S)"
185 C=M-(D*10+E*5)\F=INT(C)\IF F=0 THEN 215
210 PRINT F;"ONE DOLLAR BILL(S)"
215 C=M-(D*10+E*5+F)\C=C*100\N=C\G=INT(C/50)\IF G=0 THEN 255
250 PRINT G;"ONE-HALF DOLLAR(S)"
255 C=N-(G*50)\H=INT(C/25)\IF H=0 THEN 285
280 PRINT H;"QUARTER(S)"
285 C=N-(G*50+H*25)\I=INT(C/10)\IF I=0 THEN 315
310 PRINT I;"DIME(S)"
315 C=N-(G*50+H*25+I*10)\J=INT(C/5)\IF J=0 THEN 345
340 PRINT J;"NICKEL(S)"
345 C=N-(G*50+H*25+I*10+J*5)\K=INT(C+.5)\IF K=0 THEN 380
370 PRINT K;"PENNY(S)"
380 PRINT "THANK YOU,COME AGAIN"\PRINT \PRINT \GO TO 10
999 END

34
dec/POET.BAS Normal file
View File

@ -0,0 +1,34 @@
90 RANDOMIZE
100 IF I<>1 THEN 101 ELSE PRINT "MIDNIGHT DREARY";
101 IF I<>2 THEN 102 ELSE PRINT "FIREY EYES";
102 IF I<>3 THEN 103 ELSE PRINT "BIRD OR FIEND";
103 IF I<>4 THEN 104 ELSE PRINT "THING OF EVIL";
104 IF I<>5 THEN 210 ELSE PRINT "PROPHET";
105 GOTO 210
110 IF I<>1 THEN 111 ELSE PRINT "BEGUILING ME";
111 IF I<>2 THEN 112 ELSE PRINT "THRILLED ME";
112 IF I<>3 THEN 113 ELSE PRINT "STILL SITTING..."\GOTO 212
113 IF I<>4 THEN 114 ELSE PRINT "BURNED. "\GOTO 212
114 IF I<>5 THEN 210 ELSE PRINT "NEVER FLITTING";
115 GOTO 210
120 IF I<>1 THEN 121 ELSE IF U=0 THEN 210 ELSE PRINT "SIGN OF PARTING";
121 IF I<>2 THEN 122 ELSE PRINT "AND MY SOUL";
122 IF I<>3 THEN 123 ELSE PRINT "DARKNESS THERE";
123 IF I<>4 THEN 124 ELSE PRINT "SHALL BE LIFTED";
124 IF I<>5 THEN 210 ELSE PRINT "QUOTH THE RAVEN";
125 GOTO 210
130 IF I<>1 THEN 131 ELSE PRINT "NOTHING MORE";
131 IF I<>2 THEN 132 ELSE PRINT "YET AGAIN";
132 IF I<>3 THEN 133 ELSE PRINT "SLOWLY CREEPING";
133 IF I<>4 THEN 134 ELSE PRINT "...NEVERMORE";
134 IF I<>5 THEN 210 ELSE PRINT "EVERMORE.";
210 IF U=0 THEN 212 ELSE IF RND>.19 THEN 212 ELSE PRINT ",";\U=2
212 IF RND>.65 THEN 214 ELSE PRINT " ";\U=U+1\GOTO 215
214 PRINT\U=0
215 I=INT(5*RND+1)
220 J=J+1\K=K+1
230 IF U>0 THEN 240 ELSE IF INT(J/2)<>J/2 THEN 240 ELSE PRINT " ";
240 ON J GOTO 100,110,120,130,250
250 J=0\PRINT\IF K>20 THEN 270 ELSE GOTO 215
270 PRINT\U=0\K=0\GOTO 110
999 END

53
port/BOUNCE.BAS Normal file
View File

@ -0,0 +1,53 @@
90 DIM T(20)
100 PRINT "THIS SIMULATION LETS YOU SPECIFY THE INITIAL VELOCITY"
110 PRINT "OF A BALL THROWN STRAIGHT UP, AND THE COEFFICIENT OF"
120 PRINT "ELASTICITY OF THE BALL. PLEASE USE A DECIMAL FRACTION"
130 PRINT "COEFFICIENT (LESS THAN 1)."
131 PRINT
132 PRINT "YOU ALSO SPECIFY THE TIME INCREMENT TO BE USED IN"
133 PRINT "'STROBING' THE BALL'S FLIGHT (TRY .1 INITIALLY)."
134 PRINT
135 PRINT "TIME INCREMENT (SEC)";
136 INPUT S2
140 PRINT
150 PRINT "VELOCITY (FPS)";
160 INPUT V
165 PRINT
170 PRINT "COEFFICIENT";
180 INPUT C
184 PRINT
185 PRINT "FEET"
186 PRINT
187 S1=INT(70/(V/(16*S2)))
190 FOR I=1 TO S1
200 T(I)=V*C^(I-1)/16
210 NEXT I
220 FOR H=INT(-16*(V/32)^2+V^2/32+.5) TO 0 STEP -.5
221 IF INT(H)<>H THEN 225
222 PRINT H;
225 L=0
230 FOR I=1 TO S1
240 FOR T=0 TO T(I) STEP S2
245 L=L+S2
250 IF ABS(H-(.5*(-32)*T^2+V*C^(I-1)*T))>.25 THEN 270
260 PRINT TAB(L/S2);"O";
270 NEXT T
275 T=T(I+1)/2
276 IF -16*T^2+V*C^(I-1)*T<H THEN 290
280 NEXT I
290 PRINT
300 NEXT H
310 PRINT TAB(1);
320 FOR I=1 TO INT(L+1)/S2+1
330 PRINT ".";
340 NEXT I
350 PRINT
355 PRINT " 0";
360 FOR I=1 TO INT(L+.9995)
380 PRINT TAB(INT(I/S2));I;
390 NEXT I
400 PRINT
410 PRINT TAB(INT(L+1)/(2*S2)-2);"SECONDS"
420 PRINT
430 GOTO 135
440 END

26
port/CHANGE.BAS Normal file
View File

@ -0,0 +1,26 @@
2 PRINT "I, YOUR FRIENDLY EDUSYSTEM COMPUTER, WILL DETERMINE"
3 PRINT "THE CORRECT CHANGE FOR ITEMS COSTING UP TO $100."
4 PRINT\PRINT
10 PRINT "COST OF ITEM";\INPUT A\PRINT "AMOUNT OF PAYMENT";\INPUT P
20 C=P-A\M=C\IF C<>0 THEN 90 \PRINT "CORRECT AMOUNT,THANK YOU"
30 GO TO 10
90 IF C>0 THEN 120 \PRINT "SORRY,YOU HAVE SHORT CHANGED ME $";A-P
100 GO TO 10
120 PRINT "YOUR CHANGE,$";C\D=INT(C/10)\IF D=0 THEN 155
150 PRINT D;"TEN DOLLAR BILL(S)"
155 C=M-(D*10)\E=INT(C/5)\IF E=0 THEN 185
180 PRINT E;"FIVE DOLLARS BILL(S)"
185 C=M-(D*10+E*5)\F=INT(C)\IF F=0 THEN 215
210 PRINT F;"ONE DOLLAR BILL(S)"
215 C=M-(D*10+E*5+F)\C=C*100\N=C\G=INT(C/50)\IF G=0 THEN 255
250 PRINT G;"ONE-HALF DOLLAR(S)"
255 C=N-(G*50)\H=INT(C/25)\IF H=0 THEN 285
280 PRINT H;"QUARTER(S)"
285 C=N-(G*50+H*25)\I=INT(C/10)\IF I=0 THEN 315
310 PRINT I;"DIME(S)"
315 C=N-(G*50+H*25+I*10)\J=INT(C/5)\IF J=0 THEN 345
340 PRINT J;"NICKEL(S)"
345 C=N-(G*50+H*25+I*10+J*5)\K=INT(C+.5)\IF K=0 THEN 380
370 PRINT K;"PENNY(S)"
380 PRINT "THANK YOU,COME AGAIN"\PRINT \PRINT \GO TO 10
999 END

34
port/POET.BAS Normal file
View File

@ -0,0 +1,34 @@
90 RANDOMIZE
100 IF I<>1 THEN 101\ PRINT "MIDNIGHT DREARY";
101 IF I<>2 THEN 102\ PRINT "FIREY EYES";
102 IF I<>3 THEN 103\ PRINT "BIRD OR FIEND";
103 IF I<>4 THEN 104\ PRINT "THING OF EVIL";
104 IF I<>5 THEN 210\ PRINT "PROPHET";
105 GOTO 210
110 IF I<>1 THEN 111\ PRINT "BEGUILING ME";
111 IF I<>2 THEN 112\ PRINT "THRILLED ME";
112 IF I<>3 THEN 113\ PRINT "STILL SITTING..."\GOTO 212
113 IF I<>4 THEN 114\ PRINT "BURNED. "\GOTO 212
114 IF I<>5 THEN 210\ PRINT "NEVER FLITTING";
115 GOTO 210
120 IF I<>1 THEN 121\ IF U=0 THEN 210\ PRINT "SIGN OF PARTING";
121 IF I<>2 THEN 122\ PRINT "AND MY SOUL";
122 IF I<>3 THEN 123\ PRINT "DARKNESS THERE";
123 IF I<>4 THEN 124\ PRINT "SHALL BE LIFTED";
124 IF I<>5 THEN 210\ PRINT "QUOTH THE RAVEN";
125 GOTO 210
130 IF I<>1 THEN 131\ PRINT "NOTHING MORE";
131 IF I<>2 THEN 132\ PRINT "YET AGAIN";
132 IF I<>3 THEN 133\ PRINT "SLOWLY CREEPING";
133 IF I<>4 THEN 134\ PRINT "...NEVERMORE";
134 IF I<>5 THEN 210\ PRINT "EVERMORE.";
210 IF U=0 THEN 212\ IF RND(1)>.19 THEN 212\ PRINT ",";\U=2
212 IF RND(1)>.65 THEN 214\ PRINT " ";\U=U+1\GOTO 215
214 PRINT\U=0
215 I=INT(5*RND(1)+1)
220 J=J+1\K=K+1
230 IF U>0 THEN 240\ IF INT(J/2)<>J/2 THEN 240\ PRINT " ";
240 ON J GOTO 100,110,120,130,250
250 J=0\PRINT\IF K>20 THEN 270\ GOTO 215
270 PRINT\U=0\K=0\GOTO 110
999 END