5 PRINT CHR$(26)
7 PRINT TAB(25);"YAHTZEE"
8 PRINT TAB(20);"CREATIVE COMPUTING"
9 PRINT TAB(18);"MORRISTOWN, NEW JERSEY"
10 PRINT:PRINT "MODIFIED FOR THE OSBORNE-1 WITH PRINTER"
11 PRINT "BY PETER FLEMING, SFOG, 2/9/82"
15 DIM C(5),K(14,7),F(4),H2(6),L2(6),B5(7),B8(7),A$(7)
20 PRINT CHR$(7):PRINT CHR$(7):PRINT CHR$(7)
25 PRINT "THIS IS THE GAME OF YAHTZEE. DO YOU WANT COMMENTS";
30 INPUT B$:IF LEFT$(B$,1)="N" THEN 45
33 IF LEFT$(B$,1)="Y" THEN 40
35 GOSUB 935: GOTO 25
40 GOSUB 995
45 PRINT:PRINT "HOW MANY PLAYERS";:INPUT N
50 IF N<1 THEN 45
53 IF N<=7 THEN 75
55 PRINT "THE MAXIMUM NUMBER OF PLAYERS IS 7."
70 GOTO 45
75 FOR A0=1 TO N
80 PRINT "NAME OF PLAYER #";A0;:INPUT A$(A0):NEXT A0
85 PRINT:PRINT "WOULD YOU LIKE A PRINTED SCORECARD";:INPUT B$
90 IF LEFT$(B$,1)="N" THEN 100
93 IF LEFT$(B$,1)="Y" THEN 945
95 GOSUB 935:GOTO 85
100 H=0:PRINT:A=A+1:IF A<>N+1 THEN 105
104 A=1
105 FOR B=1 TO 5:C(B)=INT(6*RND(1))+1:NEXT B:PRINT
110 PRINT:PRINT A$(A);"'S NUMBERS:  ";:H=H+1
115 PRINT C(1);C(2);C(3);C(4);C(5):IF H=3 THEN 210
120 PRINT "HOW MANY DICE TO CHANGE";:INPUT E
125 IF E<>25 THEN 130
127 GOSUB 1020:GOTO 120
130 IF E>5 THEN 120
135 IF E<0 THEN 120
137 IF INT(E)<>E THEN 120
140 IF E=0 THEN 210
143 IF E=5 THEN 105
145 FOR F3=1 TO 4:F(F3)=0:NEXT F3
150 PRINT "WHICH DICE TO CHANGE";
155 ON E GOTO 160,165,170,175
160 INPUT F(1):GOTO 180
165 INPUT F(1),F(2):GOTO 180
170 INPUT F(1),F(2),F(3):GOTO 180
175 INPUT F(1),F(2),F(3),F(4)
180 FOR F1=1 TO 4:F(F1)=INT(F(F1)):IF F(F1)>5 THEN 150
185 IF F(F1)<0 THEN 150
187 NEXT F1
190 FOR F2=1 TO 4:IF F(F2)=0 THEN 200
195 C(F(F2))=INT(6*RND(1))+1
200 NEXT F2
205 GOTO 110
210 PRINT A$(A);" -- SCOREBOARD NUMBER";
215 INPUT I
220 IF I<>25 THEN 225 
223 GOSUB 1020:GOTO 210
225 IF I<1 THEN 210
227 I=INT(I):IF I<14 THEN 245
230 PRINT "CONFIRM";:INPUT B$
235 IF LEFT$(B$,1)="N" THEN 210
237 IF LEFT$(B$,1)="Y" THEN 735
240 GOSUB 935:GOTO 230
245 IF K(I,A)=0 THEN 260
250 PRINT A$(A);", YOU HAVE ALREADY USED ROW #";I;
255 PRINT "YOU HAVE"K(I,A);"POINTS IN ROW #";I:GOTO 210
260 IF I>6 THEN 305
265 REM***CATEGORIES ONE THOUGH SIX
270 K=0
275 FOR G=1 TO 5:IF C(G)<>I THEN 280
277 K=K+I
280 NEXT G:IF K=0 THEN 295
283 IF K<>1 THEN 300
285 PRINT A$(A);", YOU HAVE 1 POINT IN ROW # 1 (ACES)"
290 K(1,A)=1:GOTO 720
295 K(I,A)=.4:GOTO 620
300 K(I,A)=K:GOTO 620
305 ON I-6 GOTO 315,320,400,485,485,325,605
310 REM ***3 OF A KIND, 4 OF A KIND, YAHTZEE
315 R=3:T=C(1)+C(2)+C(3)+C(4)+C(5):GOTO 330
320 R=4:T=C(1)+C(2)+C(3)+C(4)+C(5):GOTO 330
325 R=5:T=50
330 FOR H3=1 TO 6:H2(H3)=0:NEXT H3
335 FOR H=1 TO 6:FOR H1=1 TO 5
340 IF C(H1)<>H THEN 350
345 H2(H)=H2(H)+1
350 NEXT H1:NEXT H
355 FOR H4=1 TO 6
360 IF H2(H4)>=R THEN 370
365 NEXT H4:K(I,A)=.4:GOTO 620
370 IF K(I,A)=50 THEN 380
375 K(I,A)=T:IF I<>12 THEN 395
380 PRINT CHR$(7):PRINT CHR$(7):FOR V4=1 TO 7:PRINT CHR$(7);:NEXT V4
385 PRINT "CONGRATULATIONS, ";A$(A);", YOU HAVE A YAHTZEE!!!"
390 PRINT CHR$(7):PRINT CHR$(7):FOR V4=1 TO 7:PRINT CHR$(7);:NEXT V4
395 GOTO 620
400 REM ***FULL HOUSE
405 L4=0:L5=0:FOR L=1 TO 6:L2(L)=0:NEXT L
410 FOR L=1 TO 6:FOR L1=1 TO 5
415 IF C(L1)<>L THEN 425
420 L2(L)=L2(L)+1
425 NEXT L1:NEXT L
430 FOR L3=1 TO 6
435 IF L5=1 THEN 450
440 IF L2(L3)<>2 THEN 450
445 L5=L5+1:GOTO 455
450 IF L2(L3)<>3 THEN 460
455 L4=L4+1
460 NEXT L3
465 IF L4=2 THEN 475
470 K(9,A)=.4:GOTO 620
475 K(9,A)=25:GOTO 620
480 GOTO 620
485 REM ***PUT NUMBERS IN ORDER, STRAIGHTS
490 FOR M2=1 TO 4:FOR M1=1 TO 4
495 IF C(M1+1)>=C(M1) THEN 507
500 Z=C(M1):C(M1)=C(M1+1):C(M1+1)=Z
507 NEXT M1:NEXT M2
510 G1=1
515 FOR X=2 TO 5
517 K(13,A)=Y1
525 IF C(X-1)+1<>C(X) THEN 540
530 G1=G1+1
540 NEXT X
545 IF I=11 THEN 560
550 IF G1<4 THEN 570
555 K(I,A)=30:GOTO 620
560 IF G1<>5 THEN 570
565 K(I,A)=40:GOTO 620
570 K(I,A)=.4:GOTO 620
605 REM ***CHANCE
610 Y1=0
615 FOR Y=1 TO 5:Y1=C(Y)+Y1:NEXT Y:K(13,A)=Y1
620 PRINT A$(A);", YOU NOW HAVE";INT(K(I,A));"POINTS IN ROW #";I;", ";
625 PRINT "(";
630 IF I>6 THEN 640
635 ON I GOTO 645,650,655,660,665,670
640 ON I-6 GOTO 675,680,685,690,695,700,705
645 PRINT "(1)ACES";:GOTO 710
650 PRINT "(2)TWOS";:GOTO 710
655 PRINT "(3)THREES";:GOTO 710
660 PRINT "(4)FOURS";:GOTO 710
665 PRINT "(5)FIVES";:GOTO 710
670 PRINT "(6)SIXES";:GOTO 710
675 PRINT "(7)3 OF A KIND";:GOTO 710
680 PRINT "(8)4 OF A KIND";:GOTO 710
685 PRINT "(9)FULL HOUSE";:GOTO 710
690 PRINT "(10)SMALL STRAIGHT";:RESTORE:GOTO 710
695 PRINT "(11)LARGE STRAIGHT";:GOTO 710
700 PRINT "(12)YAHTZEE";:GOTO 710
705 PRINT "(13)CHANCE";
710 IF E=25 THEN 1030
713 IF I0=25 THEN 1030
715 PRINT ")"
720 FOR B=1 TO N:FOR B1=1 TO 13
725 IF K(B1,B)=0 THEN 100
730 NEXT B1:NEXT B
735 FOR B3=1 TO N:B5(B3)=0:B8(B3)=0:NEXT B3
740 PRINT
745 FOR B3=1 TO N:FOR B4=1 TO 6
750 B5(B3)=B5(B3)+INT(K(B4,B3))
755 NEXT B4:NEXT B3
760 FOR B6=1 TO N:FOR B7=7 TO 13
765 B8(B6)=B8(B6)+INT(K(B7,B6))
770 NEXT B7:NEXT B6
775 FOR B3=1 TO N
780 IF B5(B3)<63 THEN 790
785 K(14,B3)=35
790 NEXT B3
795 LINE INPUT "ENTER 'RETURN' WHEN PRINTER IS READY. ";XX$:GOSUB 940
800 FOR A9=1 TO N
810 LPRINT TAB(19);A$(A9);"'S TOTALS":LPRINT TAB(19);"***************"
815 LPRINT
820 LPRINT "ACES-----------";INT(K(1,A9))
825 LPRINT "TWOS-----------";INT(K(2,A9))
830 LPRINT "THREES---------";INT(K(3,A9))
835 LPRINT "FOURS----------";INT(K(4,A9))
840 LPRINT "FIVES----------";INT(K(5,A9))
845 LPRINT "SIXES----------";INT(K(6,A9))
850 LPRINT "3 OF A KIND----";INT(K(7,A9))
855 LPRINT "4 OF A KIND----";INT(K(8,A9))
860 LPRINT "FULL HOUSE-----";INT(K(9,A9))
865 LPRINT "SM. STRAIGHT---";INT(K(10,A9))
870 LPRINT "LG. STRAIGHT---";INT(K(11,A9))
875 LPRINT "YAHTZEE--------";INT(K(12,A9))
880 LPRINT "CHANCE---------";INT(K(13,A9))
885 LPRINT:LPRINT "TOTAL OF UPPER HALF------";B5(A9)
890 LPRINT:LPRINT "BONUS--------------------";K(14,A9)
895 LPRINT:LPRINT "TOTAL OF LOWER HALF------";B8(A9)
900 LPRINT
905 B9=B5(A9)+B8(A9)+K(14,A9)
910 LPRINT A$(A9);"'S GRAND TOTAL--------------------------";B9
915 GOSUB 940
920 NEXT A9
925 IF I>13 THEN 210
930 GOTO 1040
935 PRINT "ANSWER WITH YES OR NO":RETURN
940 FOR E=1 TO 72:LPRINT "-";:NEXT E:LPRINT:RETURN
945 GOSUB 940
950 LPRINT "1**ACES":GOSUB 940:LPRINT "2**TWOS":GOSUB 940
955 LPRINT "3**THREES":GOSUB 940:LPRINT "4**FOURS":GOSUB 940
960 LPRINT "5**FIVES":GOSUB 940:LPRINT "6**SIXES":GOSUB 940
965 LPRINT "7**3 OF A KIND":GOSUB 940:LPRINT "8**4 OF A KIND":GOSUB 940
970 LPRINT "9**FULL HOUSE":GOSUB 940:LPRINT "10**SM. STRAIGHT":GOSUB 940
975 LPRINT "11**LG. STRAIGHT":GOSUB 940:LPRINT "12**YAHTZEE":GOSUB 940
980 LPRINT "13**CHANCE":GOSUB 940
985 FOR E1=1 TO 8:LPRINT:NEXT E1:PRINT CHR$(26):PRINT "TEAR OFF SCORECARD"
990 PRINT "AND HIT 'RETURN'!":INPUT Q:GOTO 100
995 PRINT "TOTALS WILL BE DISPLAYED IF YOU RESPOND TO "
1000 PRINT "'SCOREBOARD NUMBER?' WITH A NUMBER GREATER THAN 13."
1005 PRINT "TO SEE WHAT SCOREBOARD OPTIONS YOU HAVE NOT USED,"
1010 PRINT "RESPOND TO 'HOW MANY' OR 'SCOREBOARD NUMBER' WITH 25."
1015 RETURN
1020 PRINT:PRINT A$(A);", YOU HAVE THE FOLLOWING SCOREBOARD OPTIONS LEFT:"
1025 I0=25:FOR I=1 TO 13:IF K(I,A)=0 THEN 630
1027 GOTO 1035
1030 PRINT "  ";
1035 IF POS(0) > 50 THEN PRINT
1036 NEXT I:PRINT:PRINT:I0=0:RETURN
1040 PRINT CHR$(26):PRINT
1041 PRINT:PRINT "ANOTHER GAME?===> ":INPUT YN$
1045 IF LEFT$(YN$,1)="Y" THEN 45
1050 IF LEFT$(YN$,1)="N" THEN 1060
1055 GOSUB 935:GOTO 1041
1060 END
