mirror of
https://github.com/rfivet/BCG101.git
synced 2024-11-16 17:36:30 -05:00
160 lines
3.9 KiB
QBasic
160 lines
3.9 KiB
QBasic
90 RANDOMIZE
|
|
100 PRINT"DO YOU WANT TO SEE THE INSTRUCTIONS? (YES--1,NO--0)"
|
|
110 INPUT B7
|
|
120 IF B7=0 THEN 370
|
|
130 PRINT"THIS IS A GAME IN WHICH YOU WILL BE PLAYING AGAINST THE"
|
|
140 PRINT"RANDOM DECISION OF THE COMPUTER. THE FIELD OF PLAY IS A"
|
|
150 PRINT"CUBE OF SIDE 3. ANY OF THE 27 LOCATIONS CAN BE DESIGNATED"
|
|
160 PRINT"BY INPUTING THREE NUMBERS SUCH AS 2,3,1. AT THE START,"
|
|
170 PRINT"YOU ARE AUTOMATICALLY AT LOCATION 1,1,1. THE OBJECT OF"
|
|
180 PRINT"THE GAME IS TO GET TO LOCATION 3,3,3. ONE MINOR DETAIL,"
|
|
190 PRINT"THE COMPUTER WILL PICK,AT RANDOM,5 LOCATIONS AT WHICH"
|
|
200 PRINT"IT WILL PLANT LAND MINES. IF YOU HIT ONE OF THESE LOCATIONS,"
|
|
210 PRINT"YOU LOSE. ONE OTHER DETAIL, YOU MAY MOVE ONLY ONE SPACE "
|
|
220 PRINT"IN ONE DIRECTION EACH MOVE. FOR EXAMPLE: FROM 1,1,2 YOU"
|
|
230 PRINT"MAY MOVE TO 2,1,2 OR 1,1,3. YOU MAY NOT CHANGE"
|
|
240 PRINT"TWO OF THE NUMBERS ON THE SAME MOVE. IF YOU MAKE AN ILLEGAL"
|
|
250 PRINT"MOVE, YOU LOSE AND THE COMPUTER TAKES THE MONEY YOU MAY"
|
|
260 PRINT"HAVE BET ON THAT ROUND."
|
|
270 PRINT
|
|
280 PRINT
|
|
290 PRINT"ALL YES OR NO QUESTIONS WILL BE ANSWERED BY A 1 FOR YES"
|
|
300 PRINT"OR A 0 (ZERO) FOR NO."
|
|
310 PRINT
|
|
320 PRINT"WHEN STATING THE AMOUNT OF A WAGER, PRINT ONLY THE NUMBER"
|
|
330 PRINT"OF DOLLARS (EXAMPLE: 250) YOU ARE AUTOMATICALLY STARTED WITH A"
|
|
340 PRINT"500 DOLLAR ACCOUNT."
|
|
350 PRINT
|
|
360 PRINT "GOOD LUCK"
|
|
370 LET A1=500
|
|
380 LET A=INT(3*(RND(X)))
|
|
390 IF A<>0 THEN 410
|
|
400 LET A=3
|
|
410 LETB=INT(3*(RND(X)))
|
|
420 IFB<>0THEN440
|
|
430 LET B=2
|
|
440 LETC=INT(3*(RND(X)))
|
|
450 IFC<>0THEN470
|
|
460 LETC=3
|
|
470 LETD=INT(3*(RND(X)))
|
|
480 IFD<>0THEN500
|
|
490 LETD=1
|
|
500 LETE=INT(3*(RND(X)))
|
|
510 IFE<>0THEN530
|
|
520 LETE=3
|
|
530 LETF=INT(3*(RND(X)))
|
|
540 IFF<>0THEN560
|
|
550 LETF=3
|
|
560 LETG=INT(3*(RND(X)))
|
|
570 IFG<>0THEN590
|
|
580 LETG=3
|
|
590 LETH=INT(3*(RND(X)))
|
|
600 IFH<>0THEN620
|
|
610 LETH=3
|
|
620 LETI=INT(3*(RND(X)))
|
|
630 IFI<>0THEN650
|
|
640 LETI=2
|
|
650 LETJ=INT(3*(RND(X)))
|
|
660 IFJ<>0THEN680
|
|
670 LETJ=3
|
|
680 LETK=INT(3*(RND(X)))
|
|
690 IFK<>0THEN710
|
|
700 LETK=2
|
|
710 LETL=INT(3*(RND(X)))
|
|
720 IFL<>0THEN740
|
|
730 LETL=3
|
|
740 LETM=INT(3*(RND(X)))
|
|
750 IFM<>0THEN770
|
|
760 LETM=3
|
|
770 LETN=INT(3*(RND(X)))
|
|
780 IFN<>0THEN800
|
|
790 LET N=1
|
|
800 LET O=INT (3*(RND(X)))
|
|
810 IF O <>0 THEN 830
|
|
820 LET O=3
|
|
830 PRINT "WANT TO MAKE A WAGER?"
|
|
840 INPUT Z
|
|
850 IF Z=0 THEN 920
|
|
860 PRINT "HOW MUCH?"
|
|
870 INPUT Z1
|
|
876 IF A1<Z1 THEN 1522
|
|
880 LET W=1
|
|
890 LET X=1
|
|
900 LET Y=1
|
|
910 PRINT
|
|
920 PRINT "ITS YOUR MOVE"
|
|
930 INPUT P,Q,R
|
|
940 IFP>W+1 THEN1030
|
|
950 IFP=W+1THEN1000
|
|
960 IFQ>X+1 THEN1030
|
|
970 IF Q=(X+1) THEN 1010
|
|
980 IF R >(Y+1) THEN 1030
|
|
990 GO TO 1050
|
|
1000 IF Q>= X+1 THEN 1030
|
|
1010 IF R>=Y+1 THEN 1030
|
|
1020 GO TO 1050
|
|
1030 PRINT "ILLEGAL MOVE", "YOU LOSE"
|
|
1040 GO TO 1440
|
|
1050 LET W=P
|
|
1060 LET X=Q
|
|
1070 LET Y=R
|
|
1080 IF P=3 THEN 1100
|
|
1090 GO TO 1130
|
|
1100 IF Q=3 THEN 1120
|
|
1110 GO TO 1130
|
|
1120 IF R=3 THEN 1530
|
|
1130 IF P=A THEN 1150
|
|
1140 GO TO 1180
|
|
1150 IF Q=B THEN 1170
|
|
1160 GO TO 1180
|
|
1170 IF R=C THEN1400
|
|
1180 IF P=D THEN 1200
|
|
1190 GO TO 1230
|
|
1200 IF Q=E THEN 1220
|
|
1210 GO TO 1230
|
|
1220 IF R=F THEN 1400
|
|
1230 IF P=G THEN1250
|
|
1240 GO TO 1280
|
|
1250 IF Q=H THEN1270
|
|
1260 GO TO 1280
|
|
1270 IF R=ITHEN 1400
|
|
1280 IF P=J THEN 1300
|
|
1290 GO TO 1330
|
|
1300 IF Q=K THEN1320
|
|
1310 GO TO 1330
|
|
1320 IF R=L THEN 1440
|
|
1330 IF P=M THEN 1350
|
|
1340 GO TO 1380
|
|
1350 IF Q=N THEN 1370
|
|
1360 GO TO 1380
|
|
1370 IF R=O THEN1400
|
|
1380 PRINT "NEXT MOVE"
|
|
1390 GO TO 930
|
|
1400 PRINT"******BANG******"
|
|
1410 PRINT "YOU LOSE"
|
|
1420 PRINT
|
|
1430 PRINT
|
|
1440 IF Z=0 THEN 1580
|
|
1450 PRINT
|
|
1460 LET Z2=A1-Z1
|
|
1470 IF Z2>0 THEN 1500
|
|
1480 PRINT "YOU BUST"
|
|
1490 GO TO 1610
|
|
1500 PRINT " YOU NOW HAVE"; Z2; "DOLLARS"
|
|
1510 LET A1=Z2
|
|
1520 GO TO 1580
|
|
1522 PRINT"TRIED TO FOOL ME; BET AGAIN";
|
|
1525 GOTO 870
|
|
1530 PRINT"CONGRATULATIONS"
|
|
1540 IF Z=0 THEN 1580
|
|
1550 LET Z2=A1+Z1
|
|
1560 PRINT "YOU NOW HAVE"; Z2;"DOLLARS"
|
|
1570 LET A1=Z2
|
|
1580 PRINT"DO YOU WANT TO TRY AGAIN?"
|
|
1590 INPUT S
|
|
1600 IF S=1 THEN 380
|
|
1610 PRINT "TOUGH LUCK"
|
|
1620 PRINT
|
|
1630 PRINT " GOODBYE"
|
|
1640 END
|