Z-ZEE (Awfully Similar to Yahtzee)

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

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Glad to help! :lol:
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by sanello »

@XAVSNAP

I've gone through the iterations of your code and I feel a little bad now. I am pretty sure if I had been following your post during the week I could have saved you a whole lot of time. You wouldn't have had to rewrite all those calculations after 6's if you knew S(12) was SUM and not S(7) like you thought.
-sanello
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by sanello »

OK, here are some minor improvements. So minor it is still 2.1

Z-ZEE "celebration" ever so slightly faster.

NONE now selectable with 0 like ALL is with 6

Dice Throw enumerated

Pretty darned happy with it at this point.
Z-ZEEv2.1.P
(9.15 KiB) Downloaded 153 times
Z-ZEEv2.1.zip
wav
(275.5 KiB) Downloaded 127 times
-sanello
User avatar
XavSnap
Posts: 2195
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

Hi,

A little ASM display:

Code: Select all

1 REM [HEX:\
21,BD,40,ED,5B,0E,40,01,04,00,ED,B0,3E,03,EB,01,\
1D,00,09,EB,0E,04,ED,B0,3D,28,06,2B,2B,2B,2B,18,\
ED,3E,FF,BE,28,0A,01,FF,04,0B,78,B1,20,FB,18,D3,\
2A,0E,40,23,23,23,36,03,0E,07,C9,80,03,03,89,80,\
00,00,88,07,07,89,89,05,05,88,88,07,84,89,89,05,\
85,88,88,07,03,84,89,05,00,85,88,07,03,03,84,05,\
00,00,85,FF ]

     2 LET Y=16514
     (...)
   2110 PRINT AT 16,P-1;CHR$ USR Y;AT 17,P;"   ";AT 18,P;" ¶ ";AT 19,P;"   "
  2150 RETURN 
  2210 PRINT AT 16,P-1;CHR$ USR Y;AT 17,P;"¶  ";AT 18,P;"   ";AT 19,P;"  ¶"
  2250 RETURN 
  2310 PRINT AT 16,P-1;CHR$ USR Y;AT 17,P;"¶  ";AT 18,P;" ¶ ";AT 19,P;"  ¶"
  2350 RETURN 
  2410 PRINT AT 16,P-1;CHR$ USR Y;AT 17,P;"¶ ¶";AT 18,P;"   ";AT 19,P;"¶ ¶"
  2450 RETURN 
  2510 PRINT AT 16,P-1;CHR$ USR Y;AT 17,P;"¶ ¶";AT 18,P;" ¶ ";AT 19,P;"¶ ¶"
  2550 RETURN 
  2610 PRINT AT 16,P-1;CHR$ USR Y;AT 17,P;"¶ ¶";AT 18,P;"¶ ¶";AT 19,P;"¶ ¶"
  2650 RETURN 
     

Code: Select all

;------- TASM ASM mnemonics. -------
; Compile this file using:
; Set TASMOPTS = -b
; tasm -80 ThisCode.tas MyBinary.BIN
;-----------------------------------
; Zx81 Program name: VB81 XuR [dices.bas] :
; REM   line   name: 1 REM:    96 Bytes@4082-40E1

#define ORG  .org       ; TASM cross-assembler definitions
#define equ  .equ
;-----------------------------------


ORG $4082 ; [@16514/@h4082]

	LD HL,Graphics
loop1:
	LD DE,($400E)
	LD BC,$0004
	LDIR
	LD A,3
loop2:	
	EX DE,HL
	LD BC,29
	ADD HL,BC
	EX DE,HL
	LD C,$04
	LDIR

        DEC A
	JR Z,loop3
	DEC HL
	DEC HL
	DEC HL
	DEC HL
	JR loop2

loop3:

	LD A,$FF
	CP (HL)
	JR Z,EXIT

	LD BC,$4FF
loop4:
	DEC BC
              LD A,B
              OR C
              JR NZ,loop4

loop5:
	JR loop1
exit:
	LD HL,($400E)
	INC HL
	INC HL
	INC HL
	LD (HL),$3
	LD C,7
	RET 

Graphics:

.db $80,$03,$03,$89,$80,$00,$00,$88
.db $07,$07,$89,$89,$05,$05,$88,$88
.db $07,$84,$89,$89,$05,$85,$88,$88
.db $07,$03,$84,$89,$05,$00,$85,$88
.db $07,$03,$03,$84,$05,$00,$00,$85
.db $FF
 
.end
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 »

I think we can make the scoring faster. Because of small straight, I added the F(6) array to redundantly store the bubble sorted values used to calculate scores. If we made it skip the bubble sort that starts at 1520 when S("SM STRAIGHT") is chosen and then make that sub do its own bubble sort, we can eliminate the F calculation for the rest of them. That way everything but small straight should be faster. It is past my bedtime now (midnight here) and your clever uses of AND and NOT are confusing me right now, so I'll revisit this tomorrow.
-sanello
User avatar
XavSnap
Posts: 2195
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

Booleans on the ZX81:

Code: Select all

B=0 = FALSE
B=>0 = TRUE
B=<0 = TRUE


NOT B:

Code: Select all

If B>0 then NOT B=0
If B=0 then NOT B=1
If B<0 then NOT B=0

Code: Select all

"IF B THEN" : "IF B<>0 THEN" : "IF B<0 OR B>0 THEN"

Code: Select all

"NOT PI"="NOT -PI"=0

Code: Select all

"LET B=-PI" (TRUE)
"PRINT ("HELLO" AND B) print "HELLO""

Code: Select all

"LET B=NOT -PI" = NOT ABS (-PI)" (NOT TRUE=FALSE)
Don't print "HELLO"

Code: Select all

"B=-1"
"IF B THEN PRINT "TRUE""
"IF NOT B THEN PRINT "FALSE""
"IF NOT -1 THEN PRINT "FALSE""
"IF NOT 'TRUE' THEN PRINT "FALSE""

Code: Select all

LET A$=("HELLO" AND B)+("WORLD" AND NOT B)
B=1 A$="HELLO"
B=0 A$="WORLD"

Code: Select all

LET A=(5 AND B)
B=1 A=5
B=0 A=0

Code: Select all

LET A=NOT(A$>"5" AND NOT B)
LET A=NOT(A$>"5" AND B=0)
A$="6"
B=1 A=1
B=0 A=0


Image
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 2195
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

It's easy, but forget the test by card D(x) array...
Just get the avalaible values !

D(1) = something... D(2) = something... D(5) = something...

But for "1", how many dices?

Code: Select all

  6000 DIM R(6)
  6010 FOR A=1 TO 5
  6020 LET R(D(A))=R(D(A))+1
  6030 NEXT A
  6035 IF S>7 THEN RETURN
  
R(1)= 1 dice with the "1" value. [1][2][3][3][3]
R(2)= 1 dice with the "2" value. [1][2][3][3][3]

if R(6)=4 then you have 4* "6" dices ! [2][6][6][6][6]

Code: Select all

GOSUB 6000
IF R(1) AND R(2) AND R(3) AND R(4) AND R(5) THEN PRINT "LARGE TRAIGHT"
IF  R(2) AND R(3) AND R(4) AND R(5) AND R(6) THEN PRINT "LARGE TRAIGHT"
(...)

Code: Select all

GOSUB 6000
IF R(1) AND R(2) AND R(3) AND R(4) THEN PRINT "SMALL TRAIGHT"
IF R(2) AND R(3) AND R(4) AND R(5) THEN PRINT "SMALL TRAIGHT"
IF R(3) AND R(4) AND R(5) AND R(6) THEN PRINT "SMALL TRAIGHT"
(...)

Your double FOR-NEXT if too heavy...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 2195
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by XavSnap »

You have found so many buggs in my release... But..

Code: Select all

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

(...)
  7000 LET V=0
(...)
  7100 LET V=0
(...)
 7200 LET V=0
2 line can be deleted, the V value isn't a global variable and is used only after these 3 jumps!
It wasn't a BUGG...

Code: Select all

  1792 LET V=0
  1800 IF S>6 THEN GOTO 6000+(S*100)
(...)
  7000 REM
(...)
  7100 REM
(...)
 7200 REM
Save memory room !

But, these routines will be updated.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Moggy
Posts: 3493
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Don't worry about speeding things up because the emulators can do this for you and with real zeddy the 2 speed ROM runs the game at nearly machine code speed. On my ZX81 scoring takes 2 seconds so need for more speed I would have thought.

The "NONE" button and "DICE THROW" display are a nice feature.

Made a few alterations I know Xav doesn't like the use of FAST but it does speed things up.

Code: Select all

2 SLOW   (NEEDED TO CONFIRM SLOW WHEN GAME RE-STARTED)
1501 FAST     (SPEEDS UP SCORING ROUTINE TO ABOUT A COUPLE OF SECONDS)
990 SLOW   (MOVED UP SOME LINES TO ENTER THIS TO GO BACK TO SLOW AFTER SCORING ROUTINE)
1305 PRINT AT 21 , 0 ; "ARROWS/ENTER TO CHOOSE SCORE"    ( SHORTENED THIS LINE AS THE LETTER "E" FROM THE WORD SCORE NOT BEING ERASED)
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
Moggy
Posts: 3493
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z-ZEE (Awfully Similar to Yahtzee)

Post by Moggy »

Finally got a bonus YAHTZEE and the wildcard function seems to be working, could this be the end? :lol:

The wildcard only works on the lower section of the board like in the original 1950's rules and scores zero when used in the upper section.
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
Post Reply