mirror of
https://github.com/rfivet/BCG101.git
synced 2024-12-18 08:06:27 -05:00
34 lines
1.1 KiB
QBasic
34 lines
1.1 KiB
QBasic
|
1 PRINT "THIS PROGRAM ALLOWS YOU TO PLAY THE OLD GAME OF"
|
||
|
2 PRINT "ROCK, PAPER, AND SCISSORS AGAINST THE COMPUTER."
|
||
|
5 RANDOMIZE
|
||
|
6 PRINT "HOW MANY GAMES DO YOU WANT";\INPUT Q
|
||
|
8 IF Q<11 THEN 11
|
||
|
9 PRINT "SORRY, BUT WE AREN'T ALLOWED TO PLAY THAT MANY."\GOTO 6
|
||
|
11 FOR G=1 TO Q
|
||
|
15 PRINT\PRINT "GAME NUMBER"G
|
||
|
20 X=INT(RND(1)*3+1)
|
||
|
25 PRINT "3=ROCK...2=SCISSORS...1=PAPER"
|
||
|
30 PRINT "1....2....3....WHAT'S YOUR CHOICE";\INPUT K
|
||
|
32 IF (K-1)*(K-2)*(K-3)=0 THEN 35\PRINT "INVALID"\GOTO 25
|
||
|
35 PRINT "THIS IS MY CHOICE..."
|
||
|
40 ON X GOTO 50,60,70
|
||
|
50 PRINT "...PAPER"\GOTO 80
|
||
|
60 PRINT "...SCISSORS"\GOTO 80
|
||
|
70 PRINT "...ROCK"
|
||
|
80 IF X=K THEN 155
|
||
|
85 IF X>K THEN 125
|
||
|
90 IF X=1 THEN 105
|
||
|
95 PRINT "YOU WIN!!!"\H=H+1\GOTO 160
|
||
|
105 IF K=3 THEN 115\ GOTO 95
|
||
|
115 PRINT "WOW! I WIN!!"\C=C+1\GOTO 160
|
||
|
125 IF K<>1 THEN 115
|
||
|
140 IF X<>3 THEN 115\GOTO 95
|
||
|
155 PRINT "TIE GAME, NO WINNER."
|
||
|
160 NEXT G
|
||
|
170 PRINT\PRINT "HERE IS THE FINAL SCORE:"
|
||
|
175 PRINT "I HAVE WON"C"GAME(S)."
|
||
|
180 PRINT "YOU HAVE WON"H"GAME(S)."
|
||
|
185 PRINT "AND"Q-(C+H)"GAME(S) ENDED IN A TIE."
|
||
|
190 PRINT\PRINT "THANKS FOR PLAYING!!"
|
||
|
200 END
|