Z80-21 Yet Another "BlackJack"

General games-related topics
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z80-21 Yet Another "BlackJack"

Post by sanello »

Amazing. Did you create these fonts?
-sanello
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Z80-21 Yet Another "BlackJack"

Post by XavSnap »

Uh, i'm afraid so...
:lol:
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: Z80-21 Yet Another "BlackJack"

Post by XavSnap »

Suggestion:
Less lines... or avoid all unneeded BASIC scans:

Code: Select all

   995 GOSUB 9096
  1000 IF Y>21 AND P(1)=11 THEN LET P(1)=1
  1005 GOSUB 9096
  1010 IF Y>21 AND P(2)=11 THEN LET P(2)=1
  1015 GOSUB 9096
  1020 IF Y>21 AND P(3)=11 THEN LET P(3)=1
  1025 GOSUB 9096
  1030 IF Y>21 AND P(4)=11 THEN LET P(4)=1
  1035 GOSUB 9096
  1040 GOSUB 2000
You had to repeat " 1000 IF Y>21 AND P(x)=11 THEN LET P(x)=1" and the same GOSUB...

Code: Select all

   995 GOSUB 9096
   1000 FOR I=1 TO 4
  1010  IF Y>21 AND P(I)=11 THEN LET P(I)=1
  1020  GOSUB 9096
  1030 NEXT A
   1040 GOSUB 2000

Code: Select all

3060 IF Z>21 AND D(1)=11 THEN LET D(1)=1
  3065 GOSUB 9092
  3070 IF Z>21 AND D(2)=11 THEN LET D(2)=1
  3075 GOSUB 9092
  3080 IF Z>21 AND D(3)=11 THEN LET D(3)=1
  3085 GOSUB 9092

Code: Select all

 3170 IF Z>21 AND D(1)=11 THEN LET D(1)=1
  3175 GOSUB 9092
  3180 IF Z>21 AND D(2)=11 THEN LET D(2)=1
  3185 GOSUB 9092
  3190 IF Z>21 AND D(3)=11 THEN LET D(3)=1
  3195 GOSUB 9092
  3200 IF Z>21 AND D(4)=11 THEN LET D(4)=1
  3205 GOSUB 9092

Code: Select all

3300 IF Z>21 AND D(1)=11 THEN LET D(1)=1
  3305 GOSUB 9092
  3310 IF Z>21 AND D(2)=11 THEN LET D(2)=1
  3315 GOSUB 9092
  3320 IF Z>21 AND D(3)=11 THEN LET D(3)=1
  3325 GOSUB 9092
  3330 IF Z>21 AND D(4)=11 THEN LET D(4)=1
  3335 GOSUB 9092
  3340 IF Z>21 AND D(5)=11 THEN LET D(5)=1
  3345 GOSUB 9092
... Less lines, more memory !
Yeah !

:lol:
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: Z80-21 Yet Another "BlackJack"

Post by XavSnap »

suggestion:

Warning:
All suggestions can be done using a "NotePad", emulators... and tools...
Using a true Zx81, if you had to move lines, renumber or rewrite a bunch of line, took much time!
Editing a BASIC listing was ...fastidious, we had to print the program on the ZxPrinter, and retype-in the new program again, and again.
NotePad allows to view the whole of program, target variables and all loops.
On a true Zx81, just 21 lines was displayed! LIST 1, LIST 20, LIST 50...
Optimisation was too fastidious, and the debugging too.
Sanello's program is fine, and working.

But, in 1985 my suggestion was : "Don't waste your time to do that!"
PRN0032.jpg
PRN0032.jpg (16.9 KiB) Viewed 1148 times

Code: Select all

  4804 IF Y1>Z AND Y1<22 THEN LET K1=1
  4805 IF Y2>Z AND Y2<22 THEN LET K2=1
  4810 IF Z>21 AND Y1<22 THEN LET K1=1
  4815 IF Z>21 AND Y2<22 THEN LET K2=1
  4820 IF Z=Y1 AND Y1<22 THEN LET K1=3
  4825 IF Z=Y2 AND Y2<22 THEN LET K2=3
  4830 IF Z<22 AND Y1<22 AND P1>0 THEN LET K1=1
  4835 IF Z<22 AND Y2<22 AND P2>0 THEN LET K2=1
..."AND Y2<22"... "Y2<22", All conditions slow down the poor ZX81 BASIC !

If you had to exclude all this lines if the value is above 21, just jump them... to avoid these scans.

Step 1: (regroup all variables and check all GOSUB AND GOTO on lines in this aera)

Code: Select all

  4804 IF Y1>Z AND Y1<22 THEN LET K1=1
  4810 IF Z>21 AND Y1<22 THEN LET K1=1
  4820 IF Z=Y1 AND Y1<22 THEN LET K1=3
  4830 IF Z<22 AND Y1<22 AND P1>0 THEN LET K1=1

  4815 IF Z>21 AND Y2<22 THEN LET K2=1
  4805 IF Y2>Z AND Y2<22 THEN LET K2=1
  4825 IF Z=Y2 AND Y2<22 THEN LET K2=3
  4835 IF Z<22 AND Y2<22 AND P2>0 THEN LET K2=1
Step 2: (renumber and add GOTOs)

Code: Select all

  4800 LET K1=0
  4801 LET K2=0

  4802 IF Y1>21 THEN GOTO 4830
  4804 IF Y1>Z THEN LET K1=1
  4806 IF Z>21 THEN LET K1=1
  4808 IF Z=Y1 THEN LET K1=3
  4810 IF Z<22 AND P1>0 THEN LET K1=1
  4830 IF Y2>21 THEN GOTO 4838
  4832 IF Z>21 THEN LET K2=1
  4834 IF Y2>Z THEN LET K2=1
  4836 IF Z=Y2 THEN LET K2=3
  4838 IF Z<22 AND P2>0 THEN LET K2=1

  4837 IF Y1=21 AND Z<>21 THEN LET K1=2
Step 3: (regroup all conditions in a single line to avoid IF commands slow down)

Code: Select all

  4810 IF Y1<22 T LET K1=1 AND (...cond...) +1 AND (...cond...)+3 AND (...cond...)
  4820 IF Y2<22 T LET K2=1 AND (...cond...) +1 AND (...cond...)+3 AND (...cond...)
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Moggy
Posts: 3275
Joined: Wed Jun 18, 2008 2:00 pm

Re: Z80-21 Yet Another "BlackJack"

Post by Moggy »

An excellent version of an old favourite Sannelo great work by you and Xav.

@XavSnap.

Is there a final version of the program using your suggestions as I'm not sure how to implement them? :oops:
Attachments
thumbs-up_1f44d.png
thumbs-up_1f44d.png (14.07 KiB) Viewed 1116 times
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z80-21 Yet Another "BlackJack"

Post by sanello »

Looking through my code I see so much bloat It will probably be 8k when I'm done.
-sanello
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Z80-21 Yet Another "BlackJack"

Post by XavSnap »

Hi all,

Moggy, i'm waiting sanello's modification to improve the display.

Instead of using "PRINT AT" we can use compressed mask screens :
Cap0001.jpg
Cap0002.jpg
To fit the display in a text box for example.
Cap0003.jpg


I haven't change all displayed messaged...
"INPUT" changed to INKEY$.



[Edit: updated in the last messages]
Last edited by XavSnap on Wed Aug 03, 2022 7:52 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: Z80-21 Yet Another "BlackJack"

Post by XavSnap »

@sanello,

Could you keep the first program release in your first message to show you work and progression?
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z80-21 Yet Another "BlackJack"

Post by sanello »

@XAVSNAP

Don't hold back. I was wrong to try to reign you in. Unleash your mastery! If you wait for me you'll grow old. Work is kicking my butt for time. I think I'll go ahead and spend what little time I have to play with this system improving my other programs BEFORE I post them.
-sanello
User avatar
sanello
Posts: 100
Joined: Sat Jul 23, 2022 9:26 pm

Re: Z80-21 Yet Another "BlackJack"

Post by sanello »

Note that I for some reason put 2 lines at the beginning

91 IF W<2 THEN GOTO 9900

AND

192 IF W<1 THEN GOTO 9900

The W<2 is what it should be. (even numbered bets to have less hassle dealing with change and some other things)

This probably only has to be done once, of course, before it goes back to the next dealt hand.
-sanello
Post Reply