Video Poker

Basic and Machine Language

Moderator: Moderators

wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: Video Poker

Post by wimoos »

Can a card have two values at the same time ? This was not accounted for, so a fix is definitely needed.
I will have a look, and come back as soon as I find a decent solution.

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Re: Video Poker

Post by Schlowski »

Yes, but only the ace, as it can be the starting or finishing end of a straight. So it can be the most and least valuable card.

Edit:
I had a look at the source and it is like I thought: The ace is only evaluated as the most valuable card. But with only 26 free Bytes left after some rounds I do not see a quick solution to this. My first thought was to replace all high value aces with low value aces and recheck for a straight, but this is way to expensive in terms of bytes :-( Same for a hardcoded check for 2-3-4-5-A, if we don't want to mess with the internal values. So the only possible way I'm seeing just now is trying to optimize some more bytes out of the source to make up the needed space. Or to accept that in this version only the broadway (10-J-Q-K-A) is allowed, just like pairs below J are not valid here.
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: Video Poker

Post by wimoos »

Its easier than I thought.

You have to adapt line 190 in my earlier reply :-).
In array K() all drawn values are sorted low-to-high. All values are different, because doubles scored earlier.
In line 190, the difference between K(5) and K(1) represents a straight (ace values 14).
The difference between K(5) and K(4) is 9 only with '5' at position 4 and ace at position 5. Represents a straight with ace value 1

Regards,

Wim

Code: Select all

100 for i=1 to 5:k(i)=h(i) and 15:next
110 v=0:for i=1 to 4:a=k(i):if a=-1 then 160
120 p=0:for j=i+1 to 5:if k(j)=a then p=p+1:k(j)=-1
130 next:if p=0 then 160
140 if p>v then w=a:x=v:v=p:goto 160
150 x=p
160 next:on v goto 200,210,220
170 for i=1 to 4:for j=i+1 to 5:if k(i)>k(j) then t=k(i):k(i)=k(j):k(j)=t
180 next:next:f=2:a=h(1) and 48:for i=2 to 5:f=f and a=(h(i) and 48):next
190 a=k(1):on f-(k(5)-a=4)-(k(5)-k(4)=9) goto 230,240,250:w=0:return
200 w=2*x-(w>8)*(1-x):return
210 w=3+3*x:return
220 w=7:return
230 w=4:return
240 w=5:return
250 w=8-(a=8):return
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Re: Video Poker

Post by Schlowski »

That's a nice solution, I love it!

Unfortunately this would require a hefty change to my current version of VideoPoker, since you completely changed the scoring routines. Do you have a running version of this for an unexpanded VIC? I have no plan or time to make these changes myself, but if you have done the work already it would be nice to update the program for all others. What do you think?
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: Video Poker

Post by wimoos »

That would mean that I would have to reverse-engineer my WimBasic version towards CBM Basic.

In fact, the scoring routine in my previous reply can just be called with a GOSUB 100 as soon as the array H() holds the drawn cards.
Variable W is then returned as the index to the scoring table. W=0 when no score.

I will have a look but can not promise if and when I will do this.

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Re: Video Poker

Post by Schlowski »

I'm not sure if this is worth the effort. I could simply add a comment and a link to the WimBasic version to the first post...
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: Video Poker

Post by wimoos »

In the attachment, please find the Videopoker program (Wheel version), CBM Basic.

It runs on an unexpanded VIC with 260 bytes free. Enjoy!

Regards,

Wim.
videopoker.zip
Videopoker Wheel version
(1.97 KiB) Downloaded 114 times
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Re: Video Poker

Post by Schlowski »

Wow, great :shock:

I just replaced the old version with your version (and took the opportunity to change the credits to Schlowski/Boray/Wimoos).
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Re: Video Poker

Post by Boray »

What is the web address of the latest version? The link is broken.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Re: Video Poker

Post by Schlowski »

Should be working now, stupid typing error from me (named the file videopker instead of videopoker)...
Thanks for pointing out!
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Re: Video Poker

Post by Boray »

Thanks!
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Post Reply