1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-18 08:06:27 -05:00
BCG101/dec/YAHTZE.BAS

559 lines
13 KiB
QBasic

1000 A(0)=5
1010 FOR U=1 TO 5
1020 A(U)=7
1030 NEXT U
1040 CHANGE A TO C$
1060DIMA(15,15),T(15,15),F(15,15),S(15,15),L(15,15),K(15,15),H(15,15)
1070 FOR I=1 TO 5
1080 B(I)=0
1090 Q(I)=0
1100 A(I)=0
1110 NEXT I
1120 RANDOM
1130 PRINT "HOW MANY PLAYERS [TYPE: '0' FOR INSTRUCTIONS]";
1140 INPUT P
1150 IF P>15 THEN 1180
1160 IF P=0 THEN 4980
1170 GO TO 1200
1180 GOSUB 5710
1190 GO TO 1130
1200 IF P=.01 THEN 1220
1210 GO TO 1240
1220 GOSUB 5730
1230 GO TO 1140
1240 FOR I=1 TO P
1250 A(1,I)=-5
1260 T(1,I)=-5
1270 T(2,I)=-5
1280 F(1,I)=-5
1290 F(2,I)=-5
1300 S(1,I)=-5
1310 T(3,I)=-5
1320 F(3,I)=-5
1330 F(4,I)=-5
1340 S(2,I)=-5
1350 L(1,I)=-5
1360 Y(I)=-5
1370 C(I)=-5
1380 K(1,I)=0
1390 K(I)=0
1400 M(I)=0
1410 PRINT "NAME";
1420 INPUT N$(I)
1430 IF N$(I)="WHAT?" THEN 1450
1440 GO TO 1470
1450 GOSUB 5580
1460 GO TO 1410
1470 NEXT I
1480 R=0
1490 R=R+1
1495 IF R>13 THEN 6470
1500 PRINT
1510 PRINT
1520 PRINT "ROUND";R
1530 PRINT
1540 FOR I=1 TO P
1550 PRINT
1560 PRINT
1570 PRINT N$(I);"'S TURN"
1580 FOR L=1TO5
1590 A(L)=INT(6*RND(-1)+1)
1600 NEXT L
1605 GOSUB 1610
1607 GO TO 1700
1610 G=0
1620 FOR X=1 TO 5
1630 IF A(X)>=A(X+1) THEN 1680
1640 H=A(X)
1650 A(X)=A(X+1)
1660 A(X+1)=H
1670 G=1
1680 NEXT X
1685 IF G=1 THEN 1610
1690 RETURN
1700 PRINT "YOU HAVE A ";A(1);A(2);A(3);A(4);A(5)
1710 PRINT "THIS IS YOUR 2ND OF 3 ROLLS,"
1720 PRINT "HOW MANY DO YOU WANT TO CHANGE";
1730 INPUT Z
1740 IF Z=.01 THEN 1760
1750 GO TO 1780
1760 GOSUB 5600
1770 GO TO 1730
1780 IF Z=0 THEN 2620
1790 IF Z=5 THEN 1890
1800 FOR S=1 TO Z
1810 PRINT "WHICH";
1820 INPUT B(S)
1830 IF B(S)=.01 THEN 1850
1840 GO TO 1870
1850 GOSUB 5620
1860 GO TO 1810
1870 NEXT S
1880 GO TO 1930
1890 FOR S=1 TO 5
1900 A(S)=INT(6*RND(-1)+1)
1910 NEXT S
1920 GO TO 2050
1930 FOR L=1 TO 5
1940 FOR L1=1 TO 5
1950 IF B(L)=L1 THEN 1970
1960 GO TO 1980
1970 A(L1)=Q(L1)
1980 NEXT L1
1990 NEXT L
2000 FOR S=1 TO 5
2010 IF A(S)=0 THEN 2030
2020 GO TO 2040
2030 A(S)=INT(6*RND(-1)+1)
2040 NEXT S
2050 GOSUB 1610
2140 PRINT "YOU HAVE A ";A(1);A(2);A(3);A(4);A(5)
2150 PRINT "THIS IS YOUR LAST ROLL,"
2160 PRINT "HOW MANY DO YOU WANT TO CHANGE";
2170 INPUT Z
2180 IF Z=.01 THEN 2200
2190 GO TO 2220
2200 GOSUB 5600
2210 GO TO 2170
2220 IF Z=0 THEN 2620
2230 IF Z=5 THEN 2360
2240 FOR E=1 TO 5
2250 B(E)=0
2260 NEXT E
2270 FOR S=1 TO Z
2280 PRINT "WHICH";
2290 INPUT B(S)
2300 IF B(S)=.01 THEN 2320
2310 GO TO 2340
2320 GOSUB 5620
2330 GO TO 2280
2340 NEXT S
2350 GO TO 2400
2360 FOR S=1 TO 5
2370 A(S)=INT(6*RND(-1)+1)
2380 NEXT S
2390 GO TO 2520
2400 FOR L=1 TO 5
2410 FOR L1=1 TO 5
2420 IF B(L)=L1 THEN 2440
2430 GO TO 2450
2440 A(L1)=Q(L)
2450 NEXT L1
2460 NEXT L
2470 FOR S=1 TO 5
2480 IF A(S)=0 THEN 2500
2490 GO TO 2510
2500 A(S)=INT(6*RND(-1)+1)
2510 NEXT S
2520 GOSUB 1610
2610 PRINT "YOU HAVE A ";A(1);A(2);A(3);A(4);A(5)
2620 PRINT "HOW DO YOU WANT THIS ROUND SCORED";
2630 INPUT Z$
2640 IF Z$="WHAT?" THEN 2680
2650 IF Z$="SUMMARY" THEN 2670
2660 GO TO 2700
2670 GOSUB 6140
2675 GO TO 2620
2680 GOSUB 5650
2690 GO TO 2630
2700 IF Z$="ACES" THEN 2850
2710 IF Z$="TWOS" THEN 2940
2720 IF Z$="THREES" THEN 3030
2730 IF Z$="FOURS" THEN 3120
2740 IF Z$="FIVES" THEN 3210
2750 IF Z$="SIXES" THEN 3300
2760 IF Z$="THREE OF A KIND" THEN 3390
2770 IF Z$="FOUR OF A KIND" THEN 3440
2780 IF Z$="FULL HOUSE" THEN 3520
2790 IF Z$="SM. STRAIGHT" THEN 3620
2800 IF Z$="LG. STRAIGHT" THEN 3660
2810 IF Z$="YAHTZEE" THEN 3730
2820 IF Z$="CHANCE" THEN 3820
2830 IF Z$="ZERO" THEN 3890
2840 GO TO 2620
2850 IF A(1,I)<>-5 THEN 3870
2860 A(1,I)=0
2870 FOR S=1 TO 5
2880 IF A(S)=1 THEN 2900
2890 GO TO 2910
2900 A(1,I)=A(1,I)+1
2910 NEXT S
2920 M(I)=A(1,I)
2930 GO TO 4690
2940 IF T(1,I)<>-5 THEN 3870
2950 T(1,I)=0
2960 FOR S=1 TO 5
2970 IF A(S)=2 THEN 2990
2980 GO TO 3000
2990 T(1,I)=T(1,I)+2
3000 NEXT S
3010 M(I)=T(1,I)
3020 GO TO 4690
3030 IF T(2,I)<>-5 THEN 3870
3040 T(2,I)=0
3050 FOR S=1 TO 5
3060 IF A(S)=3 THEN 3080
3070 GO TO 3090
3080 T(2,I)=T(2,I)+3
3090 NEXT S
3100 M(I)=T(2,I)
3110 GO TO 4690
3120 IF F(1,I)<>-5 THEN 3870
3130 F(1,I)=0
3140 FOR S=1 TO 5
3150 IF A(S)=4 THEN 3170
3160 GO TO 3180
3170 F(1,I)=F(1,I)+4
3180 NEXT S
3185 M(I)=F(1,I)
3190 GO TO 4690
3210 IF F(2,I)<>-5 THEN 3870
3220 F(2,I)=0
3230 FOR S=1 TO 5
3240 IF A(S)=5 THEN 3260
3250 GO TO 3270
3260 F(2,I)=F(2,I)+5
3270 NEXT S
3280 M(I)=F(2,I)
3290 GO TO 4690
3300 IF S(1,I)<>-5 THEN 3870
3310 S(1,I)=0
3320 FOR S=1 TO 5
3330 IF A(S)=6 THEN 3350
3340 GO TO 3360
3350 S(1,I)=S(1,I)+6
3360 NEXT S
3370 M(I)=S(1,I)
3380 GO TO 4690
3390 IF T(3,I)<>-5 THEN 3870
3400 T(3,I)=0
3410 T(3,I)=A(1)+A(2)+A(3)+A(4)+A(5)
3420 M(I)=T(3,I)
3430 GO TO 4690
3440 IF F(3,I)<>-5 THEN 3870
3450 IF A(1)<>A(4) THEN 4960
3460 IF A(2)<>A(3) THEN 4960
3470 F(3,I)=0
3480 F(3,I)=A(1)+A(2)+A(3)+A(4)+A(5)
3490 M(I)=F(3,I)
3500 F(3,I)=0
3510 GO TO 4690
3520 IF F(4,I)<>-5 THEN 3870
3530 IF A(1)<>A(2) THEN 4960
3540 IF A(4)<>A(5) THEN 4960
3550 IF A(3)<>A(2) THEN 3570
3560 GO TO 3590
3570 IF A(3)<>A(4) THEN 4960
3580 GO TO 3590
3590 F(4,I)=25
3600 M(I)=F(4,I)
3610 GO TO 4690
3620 IF S(2,I)<>-5 THEN 3870
3630 S(2,I)=30
3640 M(I)=S(2,I)
3650 GO TO 4690
3660 IF L(1,I)<>-5 THEN 3870
3670 IF A(1)<>A(5)+4 THEN 4960
3680 IF A(2)<>A(4)+2 THEN 4960
3690 IF A(3)<>A(5)+2 THEN 4960
3700 L(1,I)=40
3710 M(I)=L(1,I)
3720 GO TO 4690
3730 IF Y(I)<>-5 THEN 3870
3740 FOR O=1 TO 5
3750 FOR O1=1 TO 5
3760 IF A(O)<>A(O1) THEN 4960
3770 NEXT O1
3780 NEXT O
3790 Y(I)=50
3800 M(I)=Y(I)
3810 GO TO 4690
3820 IF C(I)<>-5 THEN 3870
3830 C(I)=A(1)+A(2)+A(3)+A(4)+A(5)
3540
3850 M(I)=C(I)
3860 GO TO 4690
3870 GOSUB 4650
3880 GO TO 2620
3890 PRINT "WHAT DO YOU WANT TO ZERO";
3900 INPUT Z$
3920 IF Z$="SUMMARY" THEN 3940
3930 GO TO 3970
3940 GOSUB 6140
3945 GO TO 2620
3950 GOSUB 5680
3960 GO TO 3900
3970 IF Z$="ACES" THEN 4110
3980 IF Z$="TWOS" THEN 4150
3990 IF Z$="THREES" THEN 4190
4000 IF Z$="FOURS" THEN 4230
4010 IF Z$="FIVES" THEN 4270
4020 IF Z$="SIXES" THEN 4310
4030 IF Z$="THREE OF A KIND" THEN 4350
4040 IF Z$="FOUR OF A KIND" THEN 4390
4050 IF Z$="FULL HOUSE" THEN 4430
4060 IF Z$="SM. STRAIGHT" THEN 4470
4070 IF Z$="LG. STRAIGHT" THEN 4510
4080 IF Z$="YAHTZEE" THEN 4550
4090 IF Z$="CHANCE" THEN 4590
4100 GO TO 3890
4110 IF A(1,I)<>-5 THEN 4630
4120 A(1,I)=0
4130 M(I)=A(1,I)
4140 GO TO 4690
4150 IF T(1,I)<>-5 THEN 4630
4160 T(1,I)=0
4170 M(I)=T(1,I)
4180 GO TO 4690
4190 IF T(2,I)<>-5 THEN 4630
4200 T(2,I)=0
4210 M(I)=T(2,I)
4220 GO TO 4690
4230 IF F(1,I)<>-5 THEN 4630
4240 F(1,I)=0
4250 M(I)=F(1,I)
4260 GO TO 4690
4270 IF F(2,I)<>-5 THEN 4630
4280 F(2,I)=0
4290 M(I)=F(2,I)
4300 GO TO 4690
4310 IF S(1,I)<>-5 THEN 4630
4320 S(1,I)=0
4330 M(I)=S(1,I)
4340 GO TO 4690
4350 IF T(3,I)<>-5 THEN 4630
4360 T(3,I)=0
4370 M(I)=T(3,I)
4380 GO TO 4690
4390 IF F(3,I)<>-5 THEN 4630
4400 F(3,I)=0
4410 M(I)=F(3,I)
4420 GO TO 4690
4430 IF F(4,I)<>-5 THEN 4630
4440 F(4,I)=0
4450 M(I)=F(4,I)
4460 GO TO 4690
4470 IF S(2,I)<>-5 THEN 4630
4480 S(2,I)=0
4490 M(I)=S(2,I)
4500 GO TO 4690
4510 IF L(1,I)<>-5 THEN 4630
4520 L(1,I)=0
4530 M(I)=L(1,I)
4540 GO TO 4690
4550 IF Y(I)<>-5 THEN 4630
4560 Y(I)=0
4570 M(I)=Y(I)
4580 GO TO 4690
4590 IF C(I)<>-5 THEN 4630
4600 C(I)=0
4610 M(I)=C(I)
4620 GO TO 4690
4630 GOSUB 4650
4640 GOTO 2620
4650 PRINT "YOU HAVE ALREADY USED ";Z$;" AS A CATEGORY";C$
4660 PRINT
4670 RETURN
4680 GOTO 2620
4690 PRINT N$(I);" YOU GET A SCORE OF ";M(I);" FOR THIS ROUND"
4700 GO TO 5750
4710 NEXT I
4720 PRINT
4730 FOR J=1 TO P
4740 IF M(J)=A(1,J) THEN 4810
4750 IF M(J)=T(1,J) THEN 4810
4760 IF M(J)=T(2,J) THEN 4810
4770 IF M(J)=F(1,J) THEN 4810
4780 IF M(J)=F(2,J) THEN 4810
4790 IF M(J)=S(1,J) THEN 4810
4800 GO TO 4920
4810 K(1,J)=K(1,J)+M(J)
4820 GO TO 4830
4830 IF K(1,J)>=63 THEN 4860
4840 K(J)=K(J)+M(J)
4850 GO TO 4930
4860 K(1,J)=K(1,J)+35
4870 PRINT C$;N$(J);" HAS ACCUMULATED AT LEAST 63 POINTS"
4880 PRINT "IN THE FIRST SIX CATEGORIES."
4890 PRINT "HE SCORES A BONUS OF 35 POINTS!";C$
4900 K(J)=K(J)+M(J)
4910 GO TO 4930
4920 K(J)=K(J)+M(J)
4930 PRINT N$(J);" HAS ";K(J);" POINTS"
4940 NEXT J
4950 GO TO 1490
4960 PRINT "IT IS ILLEGAL TO USE ";Z$;" THIS ROUND";C$
4970 GO TO 2620
4980 PRINT
4990 PRINT
5000 PRINT
5010 PRINT "INSTRUCTIONS FOR PLAYING YAHTZEE";C$
5020 PRINT
5030 PRINT "YAHTZEE MAY BE PLAYED BY UP TO 15 PEOPLE."
5040 PRINT "THE OBJECT OF THE GAME IS TO GET THE HIGHEST SCORE"
5050 PRINT "EACH PLAYER ON HIS TURN RECEIVES FROM THE COMPUTER"
5060 PRINT "THE VALUES OF THE 5 PSEUDO-DICE. HE MAY THEN ROLL"
5070 PRINT "AS MANY OF THEM AS HE WANTS TO AGAIN. HOWEVER,"
5080 PRINT "HE IS ENTITLED UP TO BUT NO MORE THAN THREE ROLLS"
5090 PRINT "OF THE DICE."
5100 PRINT " YOU TELL THE COMPUTER MANY DICE YOU"
5110 PRINT "WANT TO CHANGE, THEN TELL IT WHICH ONES IN THE FOL-"
5120 PRINT "LOWING MANNER:"
5130 PRINT
5140 PRINT " TYPE: '1' FOR THE 1ST DIE, '2' FOR THE 2ND, ETC"
5150 PRINT " AFTER THE THIRD ROLL THE PLAYER MUST DECIDE HOW"
5160 PRINT "HE WANTS TO SCORE HIS FIVE DICE."
5170 PRINT "TYPING 'SUMMARY' WILL SHOW WHAT CATEGORIES"
5180 PRINT "HAVE BEEN USED. OTHERWISE,"
5190 PRINT "YOU HAVE 13 CHOICES, TYPE 1 OF THE FOLLOWING"
5200 PRINT "DEPENDING ON HOW YOU WANT TOUR DICE SCORED."
5210 PRINT "THE CHOICES ARE:"
5220 PRINT "ACES,TWOS,THREES,FOURS,FIVES,SIXES"
5230 PRINT "THREE OF A KIND,FOUR OF A KIND,FULL HOUSE, SM. STRAIGHT,"
5240 PRINT "LG. STRAIGHT, YAHTZEE,CHANCE."
5250 PRINT "WHAT THE COMPUTER WILL DO:"
5260 PRINT "FOR ACES IT WILL COUNT AND ADD ALL YOUR ONES."
5270 PRINT "FOR TWOS IT WILL COUNT AND ADD ALL YOUR TWOS."
5280 PRINT "THE SAME IS TRUE THROUGH THE SIXES"
5290 PRINT "THREE OF A KIND WILL TOTAL ALL OF THE DICE PRO-"
5300 PRINT "VIDED THAT YOU HAVE THREE OF A KIND"
5310 PRINT "FOUR OF A KIND IS THE SAME AS THREE OF A KIND EXCEPT"
5320 PRINT "THAT YOU MUST HAVE FOUR OF A KIND"
5330 PRINT "FULL HOUSE [3 OF ONE NO. AND 2 OF ANOTHER] WILL YIELD"
5340 PRINT "25 POINTS. SM. STRAIGHT WILL GIVE YOU 30 POINTS BUT"
5350 PRINT "YOU MUST HAVE A SEQUENCE OF FOUR."
5360 PRINT "LG.STRAIGHT WILL YIELD 40 POINTS BUT YOU MUST HAVE A SE-"
5370 PRINT "QUENCE OF FIVE."
5380 PRINT "YAHTZEE WILLL GIVE 50 POINTS IF YOU HAVE FIVE OF A KIND."
5390 PRINT "CHANCE WILL TOTAL ALL OF YOUR DICE AND USE THAT AS YOUR SCORE."
5400 PRINT "CHANCE IS USEFUL WHEN YOU DON'T HAVE ANYTHING WORTH SCORING."
5410 PRINT "ANOTHER CATEGORY, 'ZERO' WILL ZERO OUT A CATEGORY"
5420 PRINT "IF YOU DON'T HAVE ANYTHING WORTH SCORING"
5430 PRINT "BUT HAVE PERHAPS ALREAOY USED YOUR CHANCE."
5440 PRINT
5450 PRINT "IF YOUR ACCUMULATED SCORE OF THE FIRST SIX CATEGORIES"
5460 PRINT "EVER REACHES AT LEAST 63 POINTS YOU WILL RECEIVE"
5470 PRINT "A BONUS OF 35 POINTS!";C$
5480 PRINT
5490 PRINT "FOR INSTRUCTIONS DURING THE RUNNING OF THE PROGRAM"
5500 PRINT "TYPE 'WHAT?' WHEN THE COMPUTER ASKS FOR A WORD, OR,"
5510 PRINT"'.01' WHEN IT WANTS A NUMBER, AND YOU WILL RECEIVE"
5520 PRINT "FURTHER NOTES RELATED TO WHAT THE COMPUTER ASKED FOR."
5530 PRINT
5540 PRINT
5550 PRINT
5560 PRINT "GOOD LUCK!!!!!";C$
5570 GO TO 1070
5580 PRINT "WHAT DO YOU WANT ONE OF THE PLAYERS CALLED BY"
5600 PRINT "HOW MANY DICE DO YOU WANT TO ROLL AGAIN";
5610 RETURN
5620 PRINT "WHICH DIE DO YOU WANT TO CHANGE"
5630 PRINT "TYPE: '1' FOR THE 1ST DIE, '2' FOR THE 2ND DIE, ETC."
5640 RETURN
5650 PRINT "IN WHICH CATEGORY DO YOU WANT THIS ROUND SCORED"
5660 PRINT "TYPING: 'SUMMARY' WILL TELL YOU WHICH CATEGORIES YOU HAVE USED";
5670 RETURN
5680 PRINT "WHICH CATEGORY DO YOU WANT ZEROED"
5690 GO TO 5660
5710 PRINT "A MAXIMUM OF 15 PLAYERS IS ALLOWED"
5720 RETURN
5730 PRINT "HOW MANY PEOPLE WISH TO PLAY";
5740 RETURN
5750 IF Z$="ACES" THEN 5880
5760 IF Z$="TWOS" THEN 5900
5770 IF Z$="THREES" THEN 5920
5780 IF Z$="FOURS" THEN 5940
5790 IF Z$="FIVES" THEN 5960
5800 IF Z$="SIXES" THEN 5980
5810 IF Z$="THREE OF A KIND" THEN 6000
5820 IF Z$="FOUR OF A KIND" THEN 6020
5830 IF Z$="FULL HOUSE" THEN 6040
5840 IF Z$="SM. STRAIGHT" THEN 6060
5850 IF Z$="LG. STRAIGHT" THEN 6080
5860 IF Z$="YAHTZEE" THEN 6100
5870 IF Z$="CHANCE" THEN 6120
5880 H(I,R)=1
5890 GO TO 4710
5900 H(I,R)=2
5910 GO TO 4710
5920 H(I,R)=3
5930 GO TO 4710
5940 H(I,R)=4
5950 GO TO 4710
5960 H(I,R)=5
5970 GO TO 4710
5980 H(I,R)=6
5990 GO TO 4710
6000 H(I,R)=7
6010 GO TO 4710
6020 H(I,R)=8
6030 GO TO 4710
6040 H(I,R)=9
6050 GO TO 4710
6060 H(I,R)=10
6070 GO TO 4710
6080 H(I,R)=11
6090 GO TO 4710
6100 H(I,R)=12
6110 GO TO 4710
6120 H(I,R)=13
6130 GO TO 4710
6140 PRINT N$(I);" HAS USED THE FOLLOWING CATEGORIES:"
6150 FOR S=1 TO (R-1)
6160 IF H(I,S)>7 THEN 6180
6170 ON H(I,S) GO TO 6190,6210,6230,6250,6270,6290,6310
6180 ON H(I,F)-7 GO TO 6330,6350,6370,6390,6410,6430
6190 PRINT "ACES, ";
6200 GO TO 6440
6210 PRINT "TWOS, ";
6220 GO TO 6440
6230 PRINT "THREES, ";
6240 GO TO 6440
6250 PRINT "FOURS, ";
6260 GO TO 6440
6270 PRINT "FIVES, ";
6280 GO TO 6440
6290 PRINT "SIXES, ";
6300 GO TO 6440
6310 PRINT "THREE OF A KIND, ";
6320 GO TO 6440
6330 PRINT "FOUR OF A KIND, ";
6340 GO TO 6440
6350 PRINT "FULL HOUSE, ";
6360 GO TO 6440
6370 PRINT "SM. STRAIGHT, ";
6380 GO TO 6440
6390 PRINT "LG. STRAIGHT, ";
6400 GO TO 6440
6410 PRINT "YAHTZEE, ";
6420 GO TO 6440
6430 PRINT "CHANCE, ";
6440 NEXT S
6445 PRINT
6446 PRINT "HE HAS ";K(I);" POINTS,"
6447 PRINT "AND ";K(1,I);" OF THE 65 POINTS NEEDED FOR THE BONUS";
6450 PRINT "."
6460 RETURN
6470 G=0
6480 FOR X=1 TO P
6490 IF S(X)>=S(X+1) THEN 6540
6500 H=S(X)
6510 S(X)=S(X+1)
6520 S(X+1)=H
6530 G=1
6540 NEXT X
6550 IF G=1 THEN 6470
6560 PRINT "THE GAME IS OVER."
6570 PRINT
6571 FOR X=1 TO P
6572 IF K(X)=S(X) THEN 6580
6573 NEXT X
6580 PRINT "THE WINNER IS ";N$(1);" WITH ";K(1);" POINTS."
6585 IF P=1 THEN 9999
6586 PRINT "OTHER FINAL SCORES ARE:"
6590 FOR Y=1 TO P
6600 IF K(Y)=S(X) THEN 6620
6610 PRINT N$(Y);" FINISHES WITH ";K(Y);" POINTS."
6620 NEXT Y
9999 END