Z80-21 Yet Another "BlackJack"
Re: Z80-21 Yet Another "BlackJack"
Uh, i'm afraid so...


Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: Z80-21 Yet Another "BlackJack"
Suggestion:
Less lines... or avoid all unneeded BASIC scans:
You had to repeat " 1000 IF Y>21 AND P(x)=11 THEN LET P(x)=1" and the same GOSUB...
... Less lines, more memory !
Yeah !

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
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
Yeah !

Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: Z80-21 Yet Another "BlackJack"
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!"
..."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)
Step 2: (renumber and add GOTOs)
Step 3: (regroup all conditions in a single line to avoid IF commands slow down)
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!"
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
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
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
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)
Re: Z80-21 Yet Another "BlackJack"
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?
@XavSnap.
Is there a final version of the program using your suggestions as I'm not sure how to implement them?

- Attachments
-
- thumbs-up_1f44d.png (14.07 KiB) Viewed 1738 times
???????????????????????????PIINKEY$?????RND????????????????????????????????????????????????????????PI????????
Re: Z80-21 Yet Another "BlackJack"
Looking through my code I see so much bloat It will probably be 8k when I'm done.
-sanello
Re: Z80-21 Yet Another "BlackJack"
Hi all,
Moggy, i'm waiting sanello's modification to improve the display.
Instead of using "PRINT AT" we can use compressed mask screens :
To fit the display in a text box for example.
I haven't change all displayed messaged...
"INPUT" changed to INKEY$.
[Edit: updated in the last messages]
Moggy, i'm waiting sanello's modification to improve the display.
Instead of using "PRINT AT" we can use compressed mask screens :
To fit the display in a text box for example.
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)
Re: Z80-21 Yet Another "BlackJack"
@sanello,
Could you keep the first program release in your first message to show you work and progression?
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)
Re: Z80-21 Yet Another "BlackJack"
@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.
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
Re: Z80-21 Yet Another "BlackJack"
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.
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