Z-ZEE (Awfully Similar to Yahtzee)

General games-related topics
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Forgot to add second part of your code :oops:

Now while the individual scores are correct the total score is still wrong.
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Add up the scores in this picture they should add up to 92 not 74 in the total score.
Attachments
SANY0086.JPG
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

Code: Select all

     5 GOSUB 9000
     8 LET ZZ=0
    10 DIM D(5)
    20 DIM K(5)
    25 DIM S(15)
    26 FOR I=1 TO 15
    27 LET S(I)=-1
    28 NEXT I
   980 GOSUB 8000
   981 DIM K(5)
   982 FOR O=1 TO 5
   983 PRINT AT 20,1+(O-1)*6;"¸¸¸¶"
   984 NEXT O
   985 LET C=0
   986 GOSUB 3000
   987 RAND
   989 FOR G=1 TO 3
   990 FOR J=1 TO 3
  1000 FOR I=1 TO 5
  1005 IF K(I)=1 THEN GOTO 1020
  1010 LET D(I)=INT (RND*6)+1
  1020 NEXT I
  1030 GOSUB 2000
  1040 NEXT J
  1041 DIM K(5)
  1044 GOSUB 8000
  1045 IF G=3 THEN GOTO 1290
  1050 PRINT AT 21,0;"CHOOSE KEEPERS THEN PRESS ENTER."
  1060 IF INKEY$="" THEN GOTO 1060

  1070 LET A$=INKEY$
  1080 IF A$=CHR$ 118 THEN GOTO 1200

  1090 IF A$="6" THEN GOTO 5000
  1100 IF A$<"1" OR A$>"5" THEN GOTO 1060
  1110 LET A=CODE A$-28
  1120 IF VAL A$=A THEN LET K(A)=NOT K(A)

  1190 PRINT AT 20,1+(A-1)*6;("¸¸¸¶" AND NOT K(A));("¿¿¿¶" AND K(A))
  1195 GOTO 1060
  1200 PRINT AT 21,0;"LOCK IN THAT CHOICE? Y/N        "
  1210 IF INKEY$<>"" THEN GOTO 1210
  1215 IF INKEY$="" THEN GOTO 1215
  1220 LET A$=INKEY$
  1225 PRINT AT 21,0;"                                "
  1230 IF A$="Y" OR A$=CHR$ 118 THEN GOTO 1286
  1240 IF A$="N" THEN GOTO 1260
  1250 GOTO 1200
  1260 DIM K(5)
  1280 GOSUB 8000
  1282 GOTO 1050
  1286 IF K(1)+K(2)+K(3)+K(4)+K(5)<>5 THEN NEXT G
  1292 IF D(1)=D(2) AND D(2)=D(3) AND D(3)=D(4) AND D(4)=D(5) AND S(14)<>0 THEN GOTO 4000
  1300 IF ZZ=1 THEN LET S(14)=0
  1301 IF ZZ=1 THEN PRINT AT 12,29;0
  1302 IF ZZ=1 THEN GOTO 981
  1305 PRINT AT 21,0;"ARROWS AND ENTER TO CHOOSE SCORE"
  1310 PRINT AT 6,9;"Š"
  
  1314 LET P1=0
  1316 LET P2=0
  1320 IF INKEY$="" THEN GOTO 1320
  1330 LET A$=INKEY$
  1340 IF (A$>"4" AND A$<"9") THEN GOTO 1349
  1342 IF A$=CHR$ 118 THEN GOTO 1500
  1345 GOTO 1320
  1349 LET A=VAL A$
  1350 PRINT AT 6+P1,9+(19 AND P2);":"
  1360 LET P1=P1-(1*(A$="7") AND P1>0)+(1*(A$="6") AND P1<(6-NOT P2))
  1370 LET P2=P2-(1*(A$="5") AND P2>0)+(1*(A$="8") AND P2<1)
  1375 IF P2=0 AND P1=6 THEN LET P1=5
  1380 PRINT AT 6+P1,9+(19 AND P2);"Š"
  1390 GOTO 1320

   1500 LET S=(P1+1)+P2*7
   1502 PRINT AT P1+6,9+(19 AND P2);">?"
   1506 IF S(S)>-1 THEN PRINT AT P1+6,9+(19 AND P2);"Š";S(S)
   1508 IF S(S)>-1 THEN GOTO 1320
   1510 IF S=14 THEN GOTO 7400

  1520 DIM C(6)
  1525 DIM F(6)
  1530 FOR I=1 TO 6
  1540 FOR N=1 TO 5
  1550 IF D(N)=I THEN LET C(I)=C(I)+1
  1555 IF D(N)=I THEN LET F(I)=F(I)+1
  1560 NEXT N
  1570 NEXT I
  1575 LET X=1
  1576 DIM D(5)
  1580 FOR I=1 TO 6
  1590 FOR N=1 TO 5
  1600 IF C(I)>0 THEN LET D(X)=I
  1602 IF C(I)>0 THEN LET X=X+1
  1605 IF C(I)>0 THEN LET C(I)=C(I)-1
  1620 NEXT N
  1630 NEXT I


  1800 IF S>6 THEN GOTO 6000+(S*100)
  1810 GOTO 6000

  2000 FOR N=1 TO 5
  2005 LET P=1+(N-1)*6
  2010 IF NOT K(N) THEN GOSUB 2000+(D(N)*100)
  2020 NEXT N
  2030 RETURN 
  2052 IF S(14)=0 THEN GOTO 3065
  2110 PRINT AT 17,P;"   ";AT 18,P;" ¶ ";AT 19,P;"   "
  2150 RETURN 
  2210 PRINT AT 17,P;"¶  ";AT 18,P;"   ";AT 19,P;"  ¶"
  2250 RETURN 
  2310 PRINT AT 17,P;"¶  ";AT 18,P;" ¶ ";AT 19,P;"  ¶"
  2350 RETURN 
  2410 PRINT AT 17,P;"¶ ¶";AT 18,P;"   ";AT 19,P;"¶ ¶"
  2450 RETURN 
  2510 PRINT AT 17,P;"¶ ¶";AT 18,P;" ¶ ";AT 19,P;"¶ ¶"
  2550 RETURN 
  2610 PRINT AT 17,P;"¶ ¶";AT 18,P;"¶ ¶";AT 19,P;"¶ ¶"
  2650 RETURN 

  3000 FOR I=1 TO 6
  3010 IF S(I)=-1 THEN RETURN 
  3020 NEXT I
  3030 FOR I=8 TO 12
  3040 IF S(I)=-1 THEN RETURN 
  3050 NEXT I
  3055 IF S(14)=-1 THEN LET ZZ=1
  3060 IF S(14)=-1 THEN RETURN 
  3065 LET T=0
  3070 FOR I=1 TO 6
  3080 LET T=T+S(I)
  3085 PRINT AT 14,29;T
  3090 NEXT I
  3100 LET S(13)=0
  3110 IF T>62 THEN LET S(13)=35
  3120 PRINT AT 12,10;T
  3130 PRINT AT 13,10;S(13)
  3140 PRINT AT 14,10;S(13)+T
  3150 IF S(15)=-1 THEN LET S(15)=0
  3155 PRINT AT 13,29;S(15)
  3160 LET B=T+(S(15)*100)
  3170 FOR I=7 TO 14
  3180 LET B=B+S(I)
  3190 PRINT AT 14,29;B
  3200 NEXT I
  3210 STOP 

  4000 GOSUB 9200
  4005 IF S(14)=-1 THEN LET S(14)=50
  4010 LET S(15)=S(15)+1
  4020 IF S(15)>0 THEN PRINT AT 13,29;S(15)*100
  4030 PRINT AT 12,29;S(14)
  4032 IF S(15)>0 THEN LET C=1
  4040 GOTO 981

  5000 FOR B=1 TO 5
  5010 LET K(B)=NOT K(B)
  5020 PRINT AT 20,1+(B-1)*6;("¸¸¸¶" AND NOT K(B));("¿¿¿¶" AND K(B))
  5030 NEXT B
  5050 GOTO 1060

# ONES:   #1
# TOWS:   #2
# THREES: #3
# FOURS:  #4
# FIVES:  #5
# SIXES:  #6
6000 DIM R(6)
6010 FOR A=1 TO 5
6020 LET R(D(A))= R(D(A))+1
6030 NEXT A
# 3 or 4 
6035 IF S=8 OR S=9 THEN RETURN
6040 LET S(S)=R(S)*S
6050 PRINT AT 5+S,9;":";S(S)
6060 FOR A=1 TO 6
6065 LET T=0
6070 FOR I=1 TO 6
6075 IF S(I)>=0 THEN LET T=T+S(I)
6080 PRINT AT 12,10;T;"  "
6085 NEXT I
6090 GOTO 981


6100 LET R=0 
6110 FOR A=1 TO 6
# Almost equal to
6120 IF R(A)>=T THEN LET R=1
6130 IF R(A)<T THEN NEXT A
6140 RETURN

# SUM:   #7
  6720 GOTO 981

# 3 OF A KIND:   #8
  6800 GOSUB 6000
  6810 LET T=3
  6820 GOSUB 6100
  6830 LET S(S)=0
  6840 IF R THEN LET S(S)=D(1)+D(2)+D(3)+D(4)+D(5)
  6850 PRINT AT 6,28;":";S(S)
  6860 GOTO 981

# 4 OF A KIND:   #9
  6900 GOSUB 6000
  6910 LET T=4
  6920 GOSUB 6100
  6930 LET S(S)=0
  6940 IF R THEN LET S(S)=D(1)+D(2)+D(3)+D(4)+D(5)
  6950 PRINT AT 7,28;":";S(S)
  6960 GOTO 981

# FULL HOUSE:   #10
  7000 LET V=0
  7010 IF D(1)=D(2) AND D(2)=D(3) AND D(4)=D(5) THEN LET V=1
  7020 IF D(1)=D(2) AND D(3)=D(4) AND D(4)=D(5) THEN LET V=1
  7060 IF V=1 THEN LET S(S)=25
  7070 IF V<>1 THEN LET S(S)=0
  7080 PRINT AT 8,28;":";S(S)
  7090 GOTO 981

# SMALL STRAIGHT:   #11
  7100 LET V=0
  7105 IF C=1 THEN LET V=1
  7110 IF F(1)>0 AND F(2)>0 AND F(3)>0 AND F(4)>0 THEN LET V=1
  7120 IF F(2)>0 AND F(3)>0 AND F(4)>0 AND F(5)>0 THEN LET V=1
  7130 IF F(3)>0 AND F(4)>0 AND F(5)>0 AND F(6)>0 THEN LET V=1
  7160 IF V=1 THEN LET S(S)=30
  7170 IF V<>1 THEN LET S(S)=0
  7180 PRINT AT 9,28;":";S(S)
  7190 GOTO 981

# LARGE STRAIGHT:   #12
  7200 LET V=0
  7205 IF C=1 THEN LET V=1
  7210 IF D(2)=D(1)+1 AND D(3)=D(2)+1 AND D(4)=D(3)+1 AND D(5)=D(4)+1 THEN LET V=1
  7260 IF V=1 THEN LET S(S)=40
  7270 IF V<>1 THEN LET S(S)=0
  7280 PRINT AT 10,28;":";S(S)
  7290 GOTO 981

# CHANCE:   #13
  7300 LET S(7)=D(1)+D(2)+D(3)+D(4)+D(5)
  7310 PRINT AT 11,28;":";S(7)
  7320 GOTO 981

# Z-ZEE:   #14
  7400 IF S(14)>-1 THEN GOTO 1320
  7405 LET S(14)=0
  7410 PRINT AT 12,28;":";S(14)
  7420 GOTO 981

#  BONUS Z-ZEE: #15


  8000 FOR N=1 TO 5
  8005 LET P=1+(N-1)*6
  8010 PRINT AT 20,P;("¸¸¸¶" AND NOT K(N));("¿¿¿¶" AND K(N))
  8020 PRINT AT 16,P-1;"¼¸¸¸º";AT 17,P-1;"º";AT 17,P+3;"º";AT 18,P-1;"º";AT 18,P+3;"º";AT 19,P-1;"º";AT 19,P+3;"º"
  8060 NEXT N
  8070 RETURN 

  9000 PRINT AT 6,5;"ONES:";AT 7,5;"TWOS:";AT 8,3;"THREES:";AT 9,4;"FOURS:";AT 10,4;"FIVES:";AT 11,4;"SIXES:";AT 12,0;"µµµµµ«sum:0";AT 13,0;"bonusš:-";AT 14,0;"grand«sum:-";AT 6,17;"3 OF A KIND:";AT 7,17;"4 OF A KIND:";AT 8,18;"FULL HOUSE:";AT 9,14;"SMALL STRAIGHT:";AT 10,14;"LARGE STRAIGHT:";AT 11,22;"CHANCE:";AT 12,23;"Z-ZEE:";AT 13,17;"bonus«z‘zee:-";AT 14,17;"total«score:-";AT 20,0;"1     2     3     4     5     6";AT 19,30;"l";AT 18,30;"l";AT 17,30;"a"
  9200 FOR I=0 TO 4
  9210 PRINT AT 0,I;"«"
  9220 PRINT AT 4,I;"«"
  9230 PRINT AT 0,I+7;"«"
  9240 PRINT AT 4,I+7;"«"
  9250 PRINT AT 0,I+13;"«"
  9260 PRINT AT 2,I+13;"«"
  9270 PRINT AT 4,I+13;"«"
  9280 PRINT AT 0,I+19;"«"
  9290 PRINT AT 2,I+19;"«"
  9300 PRINT AT 4,I+19;"«"
  9310 PRINT AT I,13;"«"
  9320 PRINT AT I,19;"«"
  9330 PRINT AT I,4-I;"«"
  9340 PRINT AT I,11-I;"«"
  9350 NEXT I
  9360 PRINT AT 2,5;"««"
  9390 NEXT I
  9400 FOR I=0 TO 4
  9410 PRINT AT 0,I;"½"
  9420 PRINT AT 4,I;"½"
  9430 PRINT AT 0,I+7;"½"
  9440 PRINT AT 4,I+7;"½"
  9450 PRINT AT 0,I+13;"½"
  9460 PRINT AT 2,I+13;"½"
  9470 PRINT AT 4,I+13;"½"
  9480 PRINT AT 0,I+19;"½"
  9490 PRINT AT 2,I+19;"½"
  9500 PRINT AT 4,I+19;"½"
  9510 PRINT AT I,13;"½"
  9520 PRINT AT I,19;"½"
  9530 PRINT AT I,4-I;"½"
  9540 PRINT AT I,11-I;"½"
  9550 NEXT I
  9560 PRINT AT 2,5;"½½"
  9570 PRINT AT 1,24;"CODE BY:"
  9580 PRINT AT 3,24;"S.ANELLO"
  9699 RETURN 
  9900 SAVE "Z-ZEE"
  9999 RUN
   
"Chance" may be ok now.
z-zee.p
(8.65 KiB) Downloaded 39 times
Z-ZEE_wav.zip
(66.67 KiB) Downloaded 38 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Bien joué mon ami! :ugeek:

I think you have done it!!!!!

Only played the one game but all scores seem to be ok as does the total score. :D

Hard work Xavier but you seemed to have solved it. I will play some more and see what happens.
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

Coooool !
Cap0003.jpg
Have fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Moggy
Posts: 3267
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Just tried another game and yes all seems ok so thanks for the time and trouble you have taken with this Xav much appreciated.

PS I don't believe your high score! :lol:
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

:lol:

I had to test... taste... it !

Thanks Sanello.
Last edited by XavSnap on Wed Aug 03, 2022 7:34 am, edited 1 time in total.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

mom needs shoes!
Cap0005.jpg
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by sanello »

Great work! I had no idea printing the 3 rows to draw the dice dots would be so much faster with one print command then with 3. Great improvement! Here are modifications I made I think make sense. One is a personal preference.
1.) Since you made the dice toggle on and off when you press the numbered position they are in, I eliminated the lock in confirmation question. I found it quite annoying and only put it in there because when I wrote the code to toggle the dice it was so slow it made sence not to toggle them and give that choice instead. I hope that makes sense.
2.) I made it so that choosing 6 to choose all the dice chooses all of them to be locked instead of changing the locked ones to unlocked and the unlocked ones to locked.
3.) This one is the personal choice. I added a transition of showing grey on the dice while rolling since doing the print job in one command line is so fast. I hate what it looks like during the rolling process if the random number comes up 2 times in a row with no visual indication that something actually happened. Three times in a row is even worse!

Last thing I haven't changed yet but think ought to be is having another name in the credits up top ;) I'd be happy to see that in the next iteration.
Z-ZEEv2.0.T81
(9.28 KiB) Downloaded 48 times
-sanello
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by sanello »

Yikes! I found a bunch of errors That weren't there before. Well, maybe not a bunch. There is a new error that when you get a double "Z-Zee" it does not let you pick the wild card score. It just starts rolling the dice. When you get a bonus Yahtzee, not only do you get 100 points, but you also get to fill in any one of the other scores. (Full house, lg straight, etc) I'll put that back in. Also, I just played a game where chance was the last roll to go for, but the game ended. I don't know why that happened yet. I'll fix those by Sunday night unless someone beats me to it.
-sanello
Post Reply