mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-19 00:26:41 -05:00
Add GUNER1 and NIM.
This commit is contained in:
parent
80eca63a73
commit
36d630613a
88
dec/GUNER1.BAS
Normal file
88
dec/GUNER1.BAS
Normal file
@ -0,0 +1,88 @@
|
||||
100 REM ARTILLERY FIRING GAME
|
||||
110 DIM A$(3)
|
||||
120 RANDOMIZE
|
||||
130 PRINT "DO YOU WANT INSTRUCTIONS";
|
||||
140 INPUT A$
|
||||
150 PRINT
|
||||
160 IF A$="NO" THEN 330
|
||||
170 PRINT " THIS GAME TESTS YOUR ABILITY TO HIT A MOVING TARGET."
|
||||
180 PRINT "YOU MUST DESTROY IT BEFORE IT DESTROYS YOU OR MOVES OUT"
|
||||
190 PRINT "OF RANGE. THE TARGET WILL MOVE RANDOMLY."
|
||||
200 PRINT
|
||||
210 PRINT " TYPE CTRL/C TO TERMINATE THE PROGRAM. TO THE QUESTON"
|
||||
220 PRINT "'ENTER SPEED' TYPE A NUMBER BETWEEN 1 AND 100. THIS IS THE"
|
||||
230 PRINT "RELATIVE SPEED OF THE TARGET WHERE 1 IS SLOWEST AND 100"
|
||||
240 PRINT "IS THE FASTEST."
|
||||
250 PRINR
|
||||
260 PRINT "TO THE QUESTION 'ENTER DISTANCE' ENTER THE MAXIMUM DISTANCE"
|
||||
270 PRINT "YOU CAN HIT FROM THE TARGET AND STILL DESTROY IT. THIS IS"
|
||||
280 PRINT "THE KILL RADIUS AND 5000 IS SUGGESTED FOR STARTERS."
|
||||
290 PRINT
|
||||
300 PRINT "ELEVATION IS THE ELEVATION OF YOUR GUN IN DEGREES WHEN YOU"
|
||||
310 PRINT "FIRE AT THE TARGET. THE MAXIMUM RANGE IS AT 45 DEGREES"
|
||||
320 PRINT
|
||||
330 PRINT "ENTER SPEED";
|
||||
340 INPUT S
|
||||
350 IF S<1 THEN 330
|
||||
360 IF S>100 THEN 330
|
||||
370 PRINT "ENTER DISTANCE";
|
||||
380 INPUT D
|
||||
390 IF D<0 THEN 370
|
||||
400 IF D>10000 THEN 370
|
||||
410 M=100000-75000*RND(0)
|
||||
420 PRINT
|
||||
430 PRINT "THE MAXIMUM RANGE OF YOUR GUN IS "M" YARDS"
|
||||
440 FOR K=1 TO M/10000
|
||||
450 LET K1=RND(0)
|
||||
460 NEXT K
|
||||
470 R=.95*M-.6*M*RND(0)
|
||||
480 LET N=0
|
||||
490 GOTO 520
|
||||
500 IF R>M THEN 840
|
||||
510 IF R<=(M/2.5) THEN 860
|
||||
520 PRINT "TARGET RANGE IS"R" YARDS"
|
||||
530 PRINT "ELEVATION";
|
||||
540 INPUT E
|
||||
550 IF E<0 THEN 840
|
||||
560 IF E> 89 THEN 800
|
||||
570 IF E <1 THEN 820
|
||||
580 N=N+1
|
||||
590 K=INT(R-M*SIN(2*E/57.3))
|
||||
600 K1=ABS(K)
|
||||
610 IF K1<D THEN 650
|
||||
620 IF K>D THEN 720
|
||||
630 IF K<-D THEN 740
|
||||
640 STOP
|
||||
650 PRINT "*** TARGET DESTROYED ***"
|
||||
660 GOSUB 940
|
||||
670 D1=K
|
||||
680 FOR K=1 TO N+D/100
|
||||
690 K1=RND(0)
|
||||
700 NEXT K
|
||||
710 GOTO 410
|
||||
720 PRINT "SHORT OF TARGET BY "K1" YARDS"
|
||||
730 GOTO 745
|
||||
740 PRINT "OVER TARGET BY ";K1"YARDS"
|
||||
745 LET C=INT(2*RND(0)+1)
|
||||
746 IF C=1 THEN 750
|
||||
748 LET C=-1
|
||||
749 GOTO 760
|
||||
750 LET C=1
|
||||
760 C1=M*S/100*RND(0)
|
||||
770 C1=C*C1
|
||||
780 R=R+C1
|
||||
790 GOTO 500
|
||||
800 PRINT "MAXIMUM EVEVATION IS 89 DEGREES"
|
||||
810 GOTO 530
|
||||
820 PRINT "MINIMUM ELEVATION IS 1 DEGREE"
|
||||
830 GOTO 530
|
||||
840 PRINT "* TARGET OUT OF RANGE *"
|
||||
850 GOTO 670
|
||||
860 PRINT "THE TARGET HAS DESTROYED YOU!"
|
||||
870 GOTO 670
|
||||
940 IF N=1 THEN 970
|
||||
950 PRINT N" ROUNDS EXPENDED"
|
||||
960 RETURN
|
||||
970 PRINT "***** DIRECT HIT *****"
|
||||
980 RETURN
|
||||
990 END
|
93
dec/NIM.BAS
Normal file
93
dec/NIM.BAS
Normal file
@ -0,0 +1,93 @@
|
||||
100 REM THIS PROGRAM USES A STRATEGY AS PRESENTED IN 'GAMES OF FUN AND
|
||||
105 REM STRATEGY', A PUBLICATION OF THE MATHEMATICAL SERVICES DEPART-
|
||||
110 REM MENT OF COMPUTER CONTROL CO., INC.
|
||||
115 PRINT "THIS PROGRAM PLAYS NIM."
|
||||
120 PRINT "DO YOU WANT INSTRUCTIONS";\INPUT Q$
|
||||
125 IF Q$="YES" THEN 135\IF Q$="NO" THEN 190
|
||||
130 PRINT "TYPE YES OR NO."\INPUT Q$\GOTO 125
|
||||
135 PRINT
|
||||
140 PRINT " NIM IS PLAYED BY TWO PEOPLE PLAYING ALTERNATELY. BEFORE"
|
||||
145 PRINT "THE PLAY STARTS, AN ARBITRARY NUMBER OF STICKS OR OBJECTS IS"
|
||||
150 PRINT "PUT INTO AN ARBITRARY NUMBER OF PILES, IN ANY DISTRIBUTION"
|
||||
155 PRINT "WHATEVER. THEN EACH PLAYER IN HIS TURN REMOVE AS MANY"
|
||||
160 PRINT "STICKS AS HE WISHES FROM ANY PILE--BUT FROM ONLY ONE PILE,"
|
||||
165 PRINT "AND AT LEAST ONE STICK. THE PLAYER WHO TAKES THE LAST STICK"
|
||||
170 PRINT "IS THE WINNER."
|
||||
175 PRINT " THIS PROGRAM ALLOWS YOU TO SET UP THE INITIAL ARRANGEMENT"
|
||||
180 PRINT "OF PILES AND STICKS. IT WILL NOT ACCEPT MORE THAN TWENTY"
|
||||
185 PRINT "PILES OR STICKS IN EACH PILE."
|
||||
190 RANDOM
|
||||
195 REM------------------CONFIGURATION INPUT---------------------------
|
||||
200 DIM X(20,4),S(20),L(20),S2(20),N2(4),C(20),S3(20),V(20)
|
||||
205 PRINT\PRINT "HOW MANY PILES";\INPUT P\IF P>20 THEN 215
|
||||
210 IF P>INT(P) THEN 215\IF P<=0 THEN 215\GO TO 220
|
||||
215 PRINT "ILLEGAL PILE NUMBER."\PRINT\GO TO 205
|
||||
220 PRINT\FOR I=1 TO P
|
||||
225 PRINT "HOW MANY STICK IN PILE";I;\INPUT L(I)\IF L(I)>20 THEN 235
|
||||
230 IF L(I)>INT(L(I)) THEN 235\IF L(I)<=0 THEN 235\GO TO 240
|
||||
235 PRINT "ILLEGAL STICK NUMBER."\PRINT\GO TO 225
|
||||
240 NEXT I
|
||||
245 FOR I=1 TO P\S(I)=L(I)\G=G+L(I)\NEXT I
|
||||
250 PRINT\PRINT "DO YOU WANT TO GO FIRST";
|
||||
255 INPUT Q$\IF Q$="YES" THEN 340\IF Q$="NO" THEN 390
|
||||
260 PRINT "TYPE YES OR NO."\GO TO 255
|
||||
265 REM--CONTROL OF GAME REPEATS AND TESTS FOR END OF GAME-------------
|
||||
270 IF G=0 THEN 275\IF F=1 THEN 390\GO TO 320
|
||||
275 IF F=1 THEN 315
|
||||
280 PRINT\PRINT "I WON. DO YOU WANT TO PLAY AGAIN";
|
||||
285 INPUT Q$\IF Q$="NO" THEN 290\IF Q$="YES" THEN 300\GO TO 295
|
||||
290 STOP
|
||||
295 PRINT "TYPE YES OR NO."\GO TO 285
|
||||
300 PRINT\PRINT "SAME ARRANGEMENT";
|
||||
305 INPUT Q$\IF Q$="NO" THEN 205\IF Q$="YES" THEN 245
|
||||
310 PRINT "TYPE YES OR NO."\GO TO 305
|
||||
315 PRINT\PRINT "YOU WON. DO YOU WANT TO PLAY AGAIN";\GO TO 285
|
||||
320 PRINT\PRINT "PILE NUMBER","STICKS LEFT"
|
||||
325 FOR I=1 TO P\IF S(I)=0 THEN 330\PRINT I,S(I)
|
||||
330 NEXT I
|
||||
335 REM---------------------PLAYER'S MOVE------------------------------
|
||||
340 PRINT\PRINT "WHICH PILE DO YOU WANT STICKS FROM";\INPUT N
|
||||
345 IF N>P THEN 355\IF N>INT(N) THEN 355\IF N<=0 THEN 355
|
||||
350 IF S(N)=0 THEN 355\GO TO 360
|
||||
355 PRINT "ILLEGAL PILE NUMBER."\PRINT\GO TO 340
|
||||
360 PRINT\PRINT "HOW MANY STICKS";\INPUT T
|
||||
365 IF T>S(N) THEN 370\IF T>INT(T) THEN 370\IF T<=0 THEN 370\GO TO 375
|
||||
370 PRINT "ILLEGAL STICK NUMBER."\PRINT\GO TO 360
|
||||
375 S(N)=S(N)-T\G=G-T
|
||||
380 F=1\GO TO 270
|
||||
385 REM--------------------MACHINE'S MOVE------------------------------
|
||||
390 FOR I=0 TO 4\V(I)=0\NEXT I
|
||||
395 FOR I=1 TO P
|
||||
400 C(I)=S(I)
|
||||
405 FOR E=4 TO 0 STEP -1
|
||||
410 IF S(I)<2^E THEN 415\S2(I)=S2(I)+10^E\S(I)=S(I)-2^E
|
||||
415 NEXT E
|
||||
420 FOR Y=4 TO 0 STEP -1
|
||||
425 X(I,Y)=INT(S2(I)/10^Y)\S2(I)=S2(I)-X(I,Y)*10^Y
|
||||
430 V(Y)=V(Y)+X(I,Y)
|
||||
435 NEXT Y
|
||||
440 NEXT I
|
||||
445 R=0
|
||||
450 FOR Y=4 TO 0 STEP -1
|
||||
455 IF V(Y)/2-INT(V(Y)/2)=0 THEN 480
|
||||
460 IF R=1 THEN 470\Q=INT(P*RND(X))+1
|
||||
465 IF X(Q,Y)<>1 THEN 460\X(Q,Y)=0\R=1\GO TO 480
|
||||
470 IF X(Q,Y)=1 THEN 475\X(Q,Y)=1\GO TO 480
|
||||
475 X(Q,Y)=0
|
||||
480 NEXT Y
|
||||
485 FOR I=1 TO P
|
||||
490 S2(I)=0
|
||||
495 FOR Y=4 TO 0 STEP -1
|
||||
500 S3(I)=X(I,Y)*10^Y\S2(I)=S2(I)+S3(I)
|
||||
505 NEXT Y
|
||||
510 FOR E=4 TO 0 STEP -1
|
||||
515 IF S2(I)<10^E THEN 520\S(I)=S(I)+2^E\S2(I)=S2(I)-10^E
|
||||
520 NEXT E
|
||||
525 NEXT I
|
||||
530 IF R=1 THEN 535\Q=INT(P*RND(X))+1\IF S(Q)=0 THEN 530\S(Q)=S(Q)-1
|
||||
535 D=C(Q)-S(Q)\G=G-D
|
||||
540 IF D=1 THEN 550
|
||||
545 PRINT\PRINT "I'LL TAKE";D;"STICKS FROM PILE";Q;"."\GO TO 555
|
||||
550 PRINT\PRINT "I'LL TAKE 1 STICK FROM PILE";Q;"."
|
||||
555 F=0\GO TO 270
|
||||
560 END
|
88
port/GUNER1.BAS
Normal file
88
port/GUNER1.BAS
Normal file
@ -0,0 +1,88 @@
|
||||
100 REM ARTILLERY FIRING GAME
|
||||
110 DIM A$(3)
|
||||
120 RANDOMIZE
|
||||
130 PRINT "DO YOU WANT INSTRUCTIONS";
|
||||
140 INPUT A$
|
||||
150 PRINT
|
||||
160 IF A$="NO" THEN 330
|
||||
170 PRINT " THIS GAME TESTS YOUR ABILITY TO HIT A MOVING TARGET."
|
||||
180 PRINT "YOU MUST DESTROY IT BEFORE IT DESTROYS YOU OR MOVES OUT"
|
||||
190 PRINT "OF RANGE. THE TARGET WILL MOVE RANDOMLY."
|
||||
200 PRINT
|
||||
210 PRINT " TYPE CTRL/C TO TERMINATE THE PROGRAM. TO THE QUESTION"
|
||||
220 PRINT "'ENTER SPEED' TYPE A NUMBER BETWEEN 1 AND 100. THIS IS THE"
|
||||
230 PRINT "RELATIVE SPEED OF THE TARGET WHERE 1 IS SLOWEST AND 100"
|
||||
240 PRINT "IS THE FASTEST."
|
||||
250 PRINT
|
||||
260 PRINT "TO THE QUESTION 'ENTER DISTANCE' ENTER THE MAXIMUM DISTANCE"
|
||||
270 PRINT "YOU CAN HIT FROM THE TARGET AND STILL DESTROY IT. THIS IS"
|
||||
280 PRINT "THE KILL RADIUS AND 5000 IS SUGGESTED FOR STARTERS."
|
||||
290 PRINT
|
||||
300 PRINT "ELEVATION IS THE ELEVATION OF YOUR GUN IN DEGREES WHEN YOU"
|
||||
310 PRINT "FIRE AT THE TARGET. THE MAXIMUM RANGE IS AT 45 DEGREES"
|
||||
320 PRINT
|
||||
330 PRINT "ENTER SPEED";
|
||||
340 INPUT S
|
||||
350 IF S<1 THEN 330
|
||||
360 IF S>100 THEN 330
|
||||
370 PRINT "ENTER DISTANCE";
|
||||
380 INPUT D
|
||||
390 IF D<0 THEN 370
|
||||
400 IF D>10000 THEN 370
|
||||
410 M=100000-75000*RND(0)
|
||||
420 PRINT
|
||||
430 PRINT "THE MAXIMUM RANGE OF YOUR GUN IS "M" YARDS"
|
||||
440 FOR K=1 TO M/10000
|
||||
450 LET K1=RND(0)
|
||||
460 NEXT K
|
||||
470 R=.95*M-.6*M*RND(0)
|
||||
480 LET N=0
|
||||
490 GOTO 520
|
||||
500 IF R>M THEN 840
|
||||
510 IF R<=(M/2.5) THEN 860
|
||||
520 PRINT "TARGET RANGE IS"R" YARDS"
|
||||
530 PRINT "ELEVATION";
|
||||
540 INPUT E
|
||||
550 IF E<0 THEN 840
|
||||
560 IF E> 89 THEN 800
|
||||
570 IF E <1 THEN 820
|
||||
580 N=N+1
|
||||
590 K=INT(R-M*SIN(2*E/57.3))
|
||||
600 K1=ABS(K)
|
||||
610 IF K1<D THEN 650
|
||||
620 IF K>D THEN 720
|
||||
630 IF K<-D THEN 740
|
||||
640 STOP
|
||||
650 PRINT "*** TARGET DESTROYED ***"
|
||||
660 GOSUB 940
|
||||
670 D1=K
|
||||
680 FOR K=1 TO N+D/100
|
||||
690 K1=RND(0)
|
||||
700 NEXT K
|
||||
710 GOTO 410
|
||||
720 PRINT "SHORT OF TARGET BY "K1" YARDS"
|
||||
730 GOTO 745
|
||||
740 PRINT "OVER TARGET BY ";K1"YARDS"
|
||||
745 LET C=INT(2*RND(0)+1)
|
||||
746 IF C=1 THEN 750
|
||||
748 LET C=-1
|
||||
749 GOTO 760
|
||||
750 LET C=1
|
||||
760 C1=M*S/100*RND(0)
|
||||
770 C1=C*C1
|
||||
780 R=R+C1
|
||||
790 GOTO 500
|
||||
800 PRINT "MAXIMUM ELEVATION IS 89 DEGREES"
|
||||
810 GOTO 530
|
||||
820 PRINT "MINIMUM ELEVATION IS 1 DEGREE"
|
||||
830 GOTO 530
|
||||
840 PRINT "* TARGET OUT OF RANGE *"
|
||||
850 GOTO 670
|
||||
860 PRINT "THE TARGET HAS DESTROYED YOU!"
|
||||
870 GOTO 670
|
||||
940 IF N=1 THEN 970
|
||||
950 PRINT N" ROUNDS EXPENDED"
|
||||
960 RETURN
|
||||
970 PRINT "***** DIRECT HIT *****"
|
||||
980 RETURN
|
||||
990 END
|
93
port/NIM.BAS
Normal file
93
port/NIM.BAS
Normal file
@ -0,0 +1,93 @@
|
||||
100 REM THIS PROGRAM USES A STRATEGY AS PRESENTED IN 'GAMES OF FUN AND
|
||||
105 REM STRATEGY', A PUBLICATION OF THE MATHEMATICAL SERVICES DEPART-
|
||||
110 REM MENT OF COMPUTER CONTROL CO., INC.
|
||||
115 PRINT "THIS PROGRAM PLAYS NIM."
|
||||
120 PRINT "DO YOU WANT INSTRUCTIONS";\INPUT Q$
|
||||
125 IF Q$="YES" THEN 135\IF Q$="NO" THEN 190
|
||||
130 PRINT "TYPE YES OR NO."\INPUT Q$\GOTO 125
|
||||
135 PRINT
|
||||
140 PRINT " NIM IS PLAYED BY TWO PEOPLE PLAYING ALTERNATELY. BEFORE"
|
||||
145 PRINT "THE PLAY STARTS, AN ARBITRARY NUMBER OF STICKS OR OBJECTS IS"
|
||||
150 PRINT "PUT INTO AN ARBITRARY NUMBER OF PILES, IN ANY DISTRIBUTION"
|
||||
155 PRINT "WHATEVER. THEN EACH PLAYER IN HIS TURN REMOVE AS MANY"
|
||||
160 PRINT "STICKS AS HE WISHES FROM ANY PILE--BUT FROM ONLY ONE PILE,"
|
||||
165 PRINT "AND AT LEAST ONE STICK. THE PLAYER WHO TAKES THE LAST STICK"
|
||||
170 PRINT "IS THE WINNER."
|
||||
175 PRINT " THIS PROGRAM ALLOWS YOU TO SET UP THE INITIAL ARRANGEMENT"
|
||||
180 PRINT "OF PILES AND STICKS. IT WILL NOT ACCEPT MORE THAN TWENTY"
|
||||
185 PRINT "PILES OR STICKS IN EACH PILE."
|
||||
190 RANDOM
|
||||
195 REM------------------CONFIGURATION INPUT---------------------------
|
||||
200 DIM X(20,4),S(20),L(20),S2(20),N2(4),C(20),S3(20),V(20)
|
||||
205 PRINT\PRINT "HOW MANY PILES";\INPUT P\IF P>20 THEN 215
|
||||
210 IF P>INT(P) THEN 215\IF P<=0 THEN 215\GO TO 220
|
||||
215 PRINT "ILLEGAL PILE NUMBER."\PRINT\GO TO 205
|
||||
220 PRINT\FOR I=1 TO P
|
||||
225 PRINT "HOW MANY STICK IN PILE";I;\INPUT L(I)\IF L(I)>20 THEN 235
|
||||
230 IF L(I)>INT(L(I)) THEN 235\IF L(I)<=0 THEN 235\GO TO 240
|
||||
235 PRINT "ILLEGAL STICK NUMBER."\PRINT\GO TO 225
|
||||
240 NEXT I
|
||||
245 FOR I=1 TO P\S(I)=L(I)\G=G+L(I)\NEXT I
|
||||
250 PRINT\PRINT "DO YOU WANT TO GO FIRST";
|
||||
255 INPUT Q$\IF Q$="YES" THEN 340\IF Q$="NO" THEN 390
|
||||
260 PRINT "TYPE YES OR NO."\GO TO 255
|
||||
265 REM--CONTROL OF GAME REPEATS AND TESTS FOR END OF GAME-------------
|
||||
270 IF G=0 THEN 275\IF F=1 THEN 390\GO TO 320
|
||||
275 IF F=1 THEN 315
|
||||
280 PRINT\PRINT "I WON. DO YOU WANT TO PLAY AGAIN";
|
||||
285 INPUT Q$\IF Q$="NO" THEN 290\IF Q$="YES" THEN 300\GO TO 295
|
||||
290 STOP
|
||||
295 PRINT "TYPE YES OR NO."\GO TO 285
|
||||
300 PRINT\PRINT "SAME ARRANGEMENT";
|
||||
305 INPUT Q$\IF Q$="NO" THEN 205\IF Q$="YES" THEN 245
|
||||
310 PRINT "TYPE YES OR NO."\GO TO 305
|
||||
315 PRINT\PRINT "YOU WON. DO YOU WANT TO PLAY AGAIN";\GO TO 285
|
||||
320 PRINT\PRINT "PILE NUMBER","STICKS LEFT"
|
||||
325 FOR I=1 TO P\IF S(I)=0 THEN 330\PRINT I,S(I)
|
||||
330 NEXT I
|
||||
335 REM---------------------PLAYER'S MOVE------------------------------
|
||||
340 PRINT\PRINT "WHICH PILE DO YOU WANT STICKS FROM";\INPUT N
|
||||
345 IF N>P THEN 355\IF N>INT(N) THEN 355\IF N<=0 THEN 355
|
||||
350 IF S(N)=0 THEN 355\GO TO 360
|
||||
355 PRINT "ILLEGAL PILE NUMBER."\PRINT\GO TO 340
|
||||
360 PRINT\PRINT "HOW MANY STICKS";\INPUT T
|
||||
365 IF T>S(N) THEN 370\IF T>INT(T) THEN 370\IF T<=0 THEN 370\GO TO 375
|
||||
370 PRINT "ILLEGAL STICK NUMBER."\PRINT\GO TO 360
|
||||
375 S(N)=S(N)-T\G=G-T
|
||||
380 F=1\GO TO 270
|
||||
385 REM--------------------MACHINE'S MOVE------------------------------
|
||||
390 FOR I=0 TO 4\V(I)=0\NEXT I
|
||||
395 FOR I=1 TO P
|
||||
400 C(I)=S(I)
|
||||
405 FOR E=4 TO 0 STEP -1
|
||||
410 IF S(I)<2^E THEN 415\S2(I)=S2(I)+10^E\S(I)=S(I)-2^E
|
||||
415 NEXT E
|
||||
420 FOR Y=4 TO 0 STEP -1
|
||||
425 X(I,Y)=INT(S2(I)/10^Y)\S2(I)=S2(I)-X(I,Y)*10^Y
|
||||
430 V(Y)=V(Y)+X(I,Y)
|
||||
435 NEXT Y
|
||||
440 NEXT I
|
||||
445 R=0
|
||||
450 FOR Y=4 TO 0 STEP -1
|
||||
455 IF V(Y)/2-INT(V(Y)/2)=0 THEN 480
|
||||
460 IF R=1 THEN 470\Q=INT(P*RND(X))+1
|
||||
465 IF X(Q,Y)<>1 THEN 460\X(Q,Y)=0\R=1\GO TO 480
|
||||
470 IF X(Q,Y)=1 THEN 475\X(Q,Y)=1\GO TO 480
|
||||
475 X(Q,Y)=0
|
||||
480 NEXT Y
|
||||
485 FOR I=1 TO P
|
||||
490 S2(I)=0
|
||||
495 FOR Y=4 TO 0 STEP -1
|
||||
500 S3(I)=X(I,Y)*10^Y\S2(I)=S2(I)+S3(I)
|
||||
505 NEXT Y
|
||||
510 FOR E=4 TO 0 STEP -1
|
||||
515 IF S2(I)<10^E THEN 520\S(I)=S(I)+2^E\S2(I)=S2(I)-10^E
|
||||
520 NEXT E
|
||||
525 NEXT I
|
||||
530 IF R=1 THEN 535\Q=INT(P*RND(X))+1\IF S(Q)=0 THEN 530\S(Q)=S(Q)-1
|
||||
535 D=C(Q)-S(Q)\G=G-D
|
||||
540 IF D=1 THEN 550
|
||||
545 PRINT\PRINT "I'LL TAKE";D;"STICKS FROM PILE";Q;"."\GO TO 555
|
||||
550 PRINT\PRINT "I'LL TAKE 1 STICK FROM PILE";Q;"."
|
||||
555 F=0\GO TO 270
|
||||
560 END
|
Loading…
Reference in New Issue
Block a user