home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
commodore-users-of-norman
/
CUON_14_(11-1984).d64
/
yahtzee
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2019-04-13
|
3KB
|
78 lines
1 DIMD(5),SC(5,16),B$(5),D$(6):DEFFNA(I)=INT(RND(1)*6+1)
2 POKE53281,0:POKE53280,12
3 FORI=1TO6:D$(I)=" "+RIGHT$(STR$(I),1)+"[146] ":NEXT
50 PRINT"[147]"SPC(9)"[129][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210][210]"
51 PRINTSPC(9)"[158] YAHTZEE! [146]"
52 PRINTSPC(9)"[129][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197][197]"
56 PRINTSPC(12)"BY VINCE SORENSEN"
57 PRINTSPC(10)"MODIFIED FOR THE C-64":PRINTSPC(12)"[154]BY HAYWARD MCKEE"
100 NP=1:PRINTSPC(9)"HOW MANY PLAYERS(1-5)";:INPUTNP:PRINT:IFNP>5THENNP=5
101 FORI=1TONP:GOSUB1999:IFLEFT$(B$(I),6)="PLAYER"THENB$(I)=MID$(B$(I),12,255)
105 NEXT
110 FORI=1TO13:FORJ=1TONP:SC(J,I)=-1:NEXT:NEXT:RD=1:PL=0
200 RO=1:RO$="12345":PL=PL+1:GOSUB1000:IFPL>NPTHENPL=1:RD=RD+1:IFRD=14THEN440
210 GOSUB1400:GOSUB300:FORI=1TO6:SC(0,I)=SC(0,I)*I:NEXT:GOSUB1500:IFRO>2THEN401
220 RO=RO+1
221 INPUT"[159] ROLL AGAIN Y [157][157][157][157][157][157][157]";A$:IFA$="N"THEN401
225 IFA$<>"Y"ANDA$<>"N"THENPRINT"[145][145]";:GOTO221
230 INPUT"[145] WHICH DICE [157][157][157]";RO$:GOTO210
300 FORI=1TO13:SC(0,I)=0:TX=0:TL=0:NEXT:FORI=1TO5:SC(0,D(I))=SC(0,D(I))+1:GOSUB398
310 TX=TX+D(I):NEXT:IFTL=1THENSC(0,12)=SC(PL,12)+50:IFSC(0,12)<50THENSC(0,12)=50
312 SC(0,13)=TX:IFSC(0,12)>50THENGOSUB780:INPUT"SCRATCH WHAT";S:GOSUB1200:SC(PL,S)=0
320 IFTL<>2THEN325
321 SC(0,7)=TX:FORI=1TO6:IFSC(0,I)>3ORSC(0,I)=1THENSC(0,8)=TX
322 NEXT:IFSC(0,8)=0THENSC(0,9)=25
325 IFTL<>3THEN330
326 FORI=1TO6:IFSC(0,I)=3THENSC(0,7)=TX
327 NEXT
330 IFTL<>4ANDTL<>5THEN397
340 IFSC(0,3)=0ORSC(0,4)=0THEN397
341 IFSC(0,2)=0ANDSC(0,6)=0THEN397
342 IFSC(0,5)=0ANDSC(0,1)=0THEN397
350 SC(0,10)=30:IFSC(0,1)=0ANDSC(0,6)=0THEN397
353 IFSC(0,5)=0ORSC(0,2)=0THEN397
360 IFTL<>4THENSC(0,11)=40
397 RETURN
398 IFSC(0,D(I))-1=0THENTL=TL+1
399 RETURN
401 USED=0:PRINT"[158] USE WHICH (1-13)";:INPUTA:IFA<1ORA>13THENPRINT"[145][145]";:GOTO401
402 GOSUB1900:IFUSED=1THEN401
404 SC(PL,A)=SC(0,A):TT=0:BT=0:BN=0:FORI=1TO6:IFSC(PL,I)>=0THENTT=TT+SC(PL,I)
409 NEXT:SC(PL,14)=TT:IFSC(PL,14)>=63THENGOSUB1998
410 FORI=7TO13:IFSC(PL,I)>=0THENBT=BT+SC(PL,I)
415 NEXT:SC(PL,15)=BT:PRINT"";:IFTT>62THENTT=TT+35
420 PRINT" TOTALS:BOTTOM"BTSPC(30)":TOP "TT:IFTT>63THENPRINT" (WITH BONUS)
421 [153][166]9)"GRAND TOTAL: "TT[170]BT"":[129]I[178]1[164]2000:[130]:[137]200
440 HS[178]0:[129]I[178]1[164]NP:SC(I,16)[178]SC(I,15)[170]SC(I,14)[170][182]((SC(I,14)[177]62)[172]35):[130]:[153]"LOAD
460 FORI=1TONP:PRINTB$(I),SC(I,16)"":NEXT
465 FORI=1TONP:IFSC(I,16)>HSTHENHS=SC(I,16):HS$=B$(I)
470 IFSC(I,16)>SC(I,0)THENSC(I,0)=SC(I,16)
480 IFSC(I,0)>AHTHENAH=SC(I,0):AH$=B$(I)
490 NEXT:PRINT"[158]THIS GAME'S HIGH SCOREWAS"HS"HELD BY ":PRINTHS$"."
500 PRINT"THE HIGHEST SCORE SO FAR IS HELD BY ":PRINTAH$" AND IS:";HS
505 PRINTSPC(12)"PLAY AGAIN? (Y/N)";
510 GETR$:ONABS(R$="")GOTO510:ONABS(ASC(R$)-88)GOTO110:END
780 PRINT"[147]YOU HAVE JUST GOTTEN ANOTHER YAHTZEE. YOU MUST SCRATCH SOMETHING";
790 PRINT"IF YOU ARE GOING TO TAKE IT. PUT IN A ZERO BELOW IF YOU AREN'T TAKING IT"
800 RETURN
1000 FORI=1TO15:SC(0,I)=0:NEXT:RETURN
1200 IFSC(PL,S)=-1THENRETURN
1202 IFS=0THENSC(0,12)=SC(0,12)-50:S=16:RETURN
1204 FORI=13TO1STEP-1:IFSC(PL,I)=-1THENSC(PL,I)=0:RETURN
1205 NEXT:RETURN
1400 FORI=1TOLEN(RO$):X=VAL(MID$(RO$,I,1)):D(X)=FNA(X):NEXT:RETURN
1500 POKE53280,9
1501 PRINT"[147][154]"TAB(8)B$(PL)TAB(31)"ROUND"RD:PRINT:FORI=1TO5:PRINTTAB(8)D$(D(I));:NEXT:PRINT""
1510 RESTORE:FORI=1TO13:READD$:IFSC(0,I)<>0ANDSC(PL,I)<0THENPRINT"";
1515 IFSC(PL,I)<0THENPRINTSPC(8)RIGHT$(STR$(I),2)" "D$;
1516 PRINTTAB(24)RIGHT$(" "+STR$(SC(0,I)),4)"":GOTO1530
1520 PRINTSPC(8)RIGHT$(STR$(I),2)" "D$TAB(24)RIGHT$(" "+STR$(SC(PL,I)),4)"*
1530 [130]:[142]
1600 [131]ACES,TWOS,THREES,FOURS,FIVES,SIXES
1610 [131]3 OF A KIND,4 OF A KIND,FULL HOUSE,SMALL STR.,LARGE STR.,YAHTZEE,CHANCE
1900 X[178]A:[139]X[178]12[167][142]
1910 [139]SC(PL,X)[177][178]0[167]USED[178]1
1920 [142]
1998 SC(PL,8)[178]SC(PL,8)[170]35:[142]
1999 [153][166]9)"NAME PLAYER"I;:[133]B$(I):[142]