Video Poker

Basic and Machine Language

Moderator: Moderators

vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

too bad there isn't a smilie with a cowboy hat for you man!

chris
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Schlowski wrote: Btw., changing the %-variables to floating points resulted in OUT OF MEMORY during the first round of the game, so I stayed with them as defined.
I will take a look into that because I think I managed to save memory when I tried that on one of the smallest arrays...

Btw, I found a bug that I forgot to mention before. If the score goes down from 10 to 9, then it says you have 90 points. Loose another, and you will have 80 points etc...

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Boray wrote: I will take a look into that because I think I managed to save memory when I tried that on one of the smallest arrays...
I was wrong there. Seems you don't have enough references to the same array to save anything there. So for the one I tried, you lost 3 bytes instead. (In other words, you would have needed 4 more references to the same array to save anything).

But something else that I saw now in your program is that you use many variable names of two characters, for example WP%() etc... Change those to just one character W%() etc and you will save loads of memory.

And non-array integers uses one extra byte in memory compared to floating point plus one extra byte for every reference. I tried to change CA% into J, and saved 29 bytes...

/Anders
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

Post by Schlowski »

Hehe, now this becomes very interesting...

I changed CA% to CA for some extra bytes and did some mor manual crunching and squeezing and ended up with 'a lot of' free mem, but since the source is at home and I'm at the office I cannot tell...

I'm not sure about non array integer variables use one more byte in memory - as far as I remember the type is coded in the var name, something like high bit set in one or both variable name chars for strings/integers/floating point. But the %-sign in the source definately uses up one byte.

Renaming the vars from 2 to 1 character will be the last thing I will do as it makes my (already unreadable) source even more uncomprehensable - at least for me. But if I'm in need for more memory, I will consider this technique.

I should save the original source and make all changes in it and afterwards optimize the hell out of it to make it run in 3583 bytes... so I would end up with a readable and a runnable source - hopefully the optimizing will not break the code :-)

Ah, and the bug you found is on my to-do list, but I have a strange effect at least in VICE, I have to prove this on the real machine:
If I make something like

Code: Select all

?"{HOME}**********"
?"{HOME}"a" "
where a is 0 then I get (without quotes)
" 0* *****"
instead of
" 0 ******"
i.e. there is an extra cursor right in the end of the var. I cannot remember this behaviour from the past...
For now I will make a

Code: Select all

?"{HOME}"a"{LEFT} "
to clear any characters directly behind my var...

More than 20 years with the VIC and even today I learn a lot of new things...

Schlowski
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I experimented with some sound effects for you:
http://user.tninet.se/~pug510w/datormus ... sound4.zip

You are welcome to use anything of it, or nothing of it however you like.

/Anders
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

Post by Schlowski »

Thank you very much, I like your sounds. After some crunching/squeezing and fiddling I managed to get your sound routines into VPoker - now we have 17 bytes free after some rounds, great :-)

Tomorrow I will be able to put the files up on my web space.

Btw., I made a lookup for the variable storage thingy for non-arrays and my memories served me right.
Storage of variables is always 7 bytes (and in case of strings additional bytes for the string value):

bytes 0-1:
byte 0 : Variable name char 1
byte 1 : Variable name char 2
for real bit 7 in byte 0+1 are clear
for integer bit 7 in byte 0+1 are set
for string bit 7 in byte 0 is clear and in byte 1 is set

bytes 2-6:
for real: value
for integer: 2-3 value, 4-6: 0
for string: 2 length, 3-4 pointer to string,5-6: 0

(info from Data Becker, VC-20 Tips&Tricks - they made very good books about VIC-20 and C=64, but afterwards they lost a lot of quality and their PC books are really crap...)

Schlowski
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

So new version is up!

(link to older version removed)

As the name and the previous post suggests, this is a version with sounds included :-)

Have fun,
Schlowski
Last edited by Schlowski on Mon Jan 16, 2006 2:34 am, edited 1 time in total.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Very nice!

But I found another bug. I played, got a full house, played some more.
Got another full house, but this one got counted as a 3-of-a-kind???

COINS: 35 GAME 10

Spades 9, Hearts 7, Cloves 7, Diamonds 9, Spades 7

Marked:
3 of a kind = 5

Here is a dump of the variables:
(Thanks to programmer's aid (DUMP), The CMD command and Textport)

I= 22
T=-3
MS= 75
RD= 10
PK= 40
KD$="{HOME}{CYN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}
{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}"
Q= 36874
CP= 6
K1= 843.570474
K2= 843.570474
M= 23
AD= 867
CA= 2
CC= 0
C$="{SH-X}"
CV= 7
CO$="R$("
CU$=""
A$=""
H= 3
P1= 3
P2= 2
F= 0
S= 0
R= 260
WP= 3
P= 2
C= 2
U= 12
WR= 330
A1= 38730
A2= 8010
B= 128


READY.
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

Post by Schlowski »

Very good bug report :-)

I think this is related to the fact that Pairs only count when Jack or higher, I think there is some bug in my code for checking FullHouse.

As one can see, P1=3 (3 of a kind) and P2=2 (Pair below Jack, otherwise it would be 128+2=130), so I have an idea where to search!

Will check this later...

Schlowski
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Fixed bug - it was something different.
After successful checking for a FullHouse one has to skip all further tests - otherwise the 3-of-a-kind check will afterwards overrule the FullHouse if it's a FullHouse with 3 lower and 2 higher cards. If it would be a 2/3 FullHouse then with Jacks or better as Pair this woule be a Pair instead of a FullHouse...

Ok, to make a long story short, new version is on the File-Server.
Or you can edit line 50 and put a :GOTO 55 at the end, then the FullHouse will be recognized always.

Thanks again for the bug report!

Schlowski
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Great! It seems to work great now. But I wonder about the scoring. If you get a pair and get one coin in reward, shouldn't you get your own coin back plus the coin for the pair? Or is the winning for a pair just to get your own coin back? I'm not familiar with other computer poker games, but maybe someone else here is? Maybe it gets too easy if you get more than your own coin back... (I stopped with 67 coins in game 122! I guess really I like this game!)

Btw, the reversed cyan text at the bottom of the screen is really hard to read on a real vic. Otherwise, I think it's splendid!

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I found another bug: If you get 100 coins or more, then the game count stops. (It gets printed under the cards instead, and the old game count where you went over 99 is stuck on the right side (in my case 95). As it is possible to get 1000 points the first game you play, I think you should try to make it work with 4 figures coins and 3 figures games.

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

And if you would like to change the color of that cyan message while you are at it... That could be done by changing both the color of it and the border color to for example blue or something... Or maybe just make it non-reversed and some other color than cyan...
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

Post by Schlowski »

You can change the color in line 68 (variable KD$, it's HOME, color, several CURDOWN) and the poke for the last byte on screen in line 31 (POKE 38905,3) to a color more pleasant. If you have something more readabel, please tell me the color/number and I can change the source here for the rest of us :-)

For the screen garbling with more then 999 credits: this is a problem caused by the way the VIC handles comma separated prints, if you get past the 11th column the VIC will position to the next line on screen. This needs more thinking and maybe more bytes then we have left... Maybe I should simply omit the game round, but I found it interesting to see how many games I played already.

And last but not least it's incidental that you only get one coin for a pair, i.e. you get no real win but your "money back" for the game - otherwise you would really fast gain a lot of coins.

Schlowski
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Maybe you could do this for the game count:
PRINT"SCORE WHATEVER":PRINT,"{up}GAME etc"

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