Video Poker

Basic and Machine Language

Moderator: Moderators

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

Video Poker

Post by Schlowski »

I finally managed to finish (more or less...) a program :-)
http://www.stojalowski.de/files/Videopoker
(This is the latest version with sound and all optimizations from Boray and me)
(Edit: And optimizations from Wimoos including the recognition of A-2-3-4-5 as a straight!)

Image

It's for unexpanded VIC, pure basic and has after a few rounds (41) 260 bytes (after the changes from Wimoos) free memory left - to be honest I didn't had the time for longer tests right now, hopefully it will not crash after a while...

Just to show the use of my cross-basic-editor, I wrote the whole thing in my BasEdit (http://sleepingelephant.com/ipw-web/bul ... .php?t=395)

Image

which is a lot easier to edit with, especially on longer lines...

Schlowski
Last edited by Schlowski on Mon Jan 16, 2006 2:33 am, edited 2 times in total.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

It looks great! Now I just need to learn the rules of poker.
High Scores, Links, and Jeff's Basic Games page.
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

You only need 'crippled' knowledge for my game, because there are no others you play against.

You get 5 cards at start and can decide which cards to hold and which cards should be dealt again. If you are finished with selecting (keys 1-5 to select/deselect) press space to deal.
Now you have 5 open cards which are checked against the winning table (lower half of screen).
If you have a win, the points are added to your coins and the game starts over. If you have no win, it simply starts over. Each round 1 coin is subtrcted from your 'money', if you arrive at 0 at the end of a round, the game is over.

The only special thing is that a single pair is only valid, if it consist of cards greater 10, ie.e Jack, Queen, King or Ace.

To be honest, the game here is not so exciting to play, but was very exciting to write :-) Especially crunching this all into 3.5k was very funny.

Nevertheless, if anybody is playing this, please give me some feedback if everything is right - or even some suggestions for improvement.

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

Post by vic user »

i just started playing it now.

seems to work just fine.

nice one man!

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

Post by vic user »

i like the way it highlights what you won with, when you win

now i can find out what the heck a flush is and all that :)

chris
Centallica
Pinballer
Posts: 1090
Joined: Wed Feb 02, 2005 11:26 am

Post by Centallica »

I think both Jeff and Chris are "Card-sharks for http://worldpokertour.com/" that're trying to "bluff" the rest of us to a future game of Poker for some serious coin :wink:
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

everything i know about poker i learned from kenny rogers.

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

Post by Schlowski »

I had to google about Poker rules to get the ranking of pairs, flushes, straights etc. I don't know what I have done in times as the internet was not existent...

Now I'm thinking about a real poker game for the expanded VIC, i.e. with one or more computer players betting and bluffing on their cards...
Should be fun to think about some sort of crude A.I. and winning strategies!

It' so great to write programs for such restricted machines, it is (for me) far more satisfying to write something for the VIC than say for a multi-gigabyte-high-end-graphics-PC - needless to say that my artistic skills better fit to character graphics than to real 3d-environments with pixel-shaders :-))
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I think it's a very nice program! I played it for 25 rounds or something (and decided to quit with something like 20 points left). But it could sure use a few sounds so you get some feedback for pressing the keys etc.

I know you have little memory for that. But just doing a RENUMBER 0,1 gives you 64 bytes more, if I remember correctly (I tried it)... You can do some other things too. For example, I think you will gain some by using floating point arrays for the smaller arrays, because you have so many references to them in the program. I added a little more about this here now (under OUT OF MEMORY?):
http://user.tninet.se/~pug510w/datormuseum/optim.html

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

Mmh, I used integer arrays because in arrays each integer var uses 2 bytes instead of 5 for floating point variables.

But your comment about renumbering is quite cool - I didn't think about the line numbers in code, which use a byte for each digit, I only thought about the starting line numbers which are coded as integers and use 2 bytes regardless of the value...

Ok, I will see if i have some time and try to squeeze as much out of this proggy as I can, I really like to optimize such things. Let's see how much bytes will be free when I'm finished and how to make some sounds. I am missing some winning sound...

And when I'm doing this I will listen to your music as always, this is a perfect combination :-)

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

Post by Schlowski »

Maybe it's me or some cache on our proxy server, but I do not see any OUT OF MEMORY? section on your optimization page...
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Strange.... Well, I can put it here as well then:

OUT OF MEMORY?
If you want a memory efficiant basic program, then here are a few tips!

* RENUMBER 0,1 - This gains memory because all the references to line numbers in the program will be shorter.
* Extra space removal - For example IF A=40 THEN 23 can just as well be written IFA=40THEN23
* ; removal. In print statements, the ";" sign can often be removed. For example: PRINTA$;"-HERE" can just as well be written: PRINTA$"-HERE"
* Using the right kind of variables! If you just use loose variables, then A= will always use less memory than A%=. Because both uses 7 bytes in memory to store the variable, while A% uses one extra byte everywhere in the program where you use it. And floating point is faster anyway, so...
* Using the right kind of arrays. Here, integers, such as DIM A%(100) uses less space than floating point (DIM A(100)). (About half the space in memory). But be aware that this can fool you. Because if you have many references to the array in the program, then the integer array can very well use more memory in total. This is most likely to be the case when you have few variables in the array, for example DIM A%(10) etc... To find out, just try to replace them and look at the FRE(0) value at run time. The Programmer's Aid's CHANGE command is useful.
* Putting as much as possible on every program line. Every new line takes some extra bytes.
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 »

Thanks, now that I'm home I can see this on your web-site too. As I imagined this was obviuosly a side effect of our proxy at my company - this damned thing has made me crazy more than once...

Back to topic, I will see what I can squeeze out of VPoke with your tips and tricks!
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Cool, using my basic editor to squeeze and renumber the source I now have 265 instead of 42 bytes free after some rounds - 223 bytes more memory with nothing but some clicks :-)

Now I can manually optimize the squeezing - the automatism only tries to append two lines if they keep below 88 bytes, but this can be made optimized by for example making 2 lines out of 3...

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.

Now we have only one problem left: I need some short basic command sequences for some nice tunes like "toggle card", "deal", "win", "loose" - anybody out there with some examples?

Schlowski
Bacon
for breakfast
Posts: 578
Joined: Mon Apr 19, 2004 8:07 am

Post by Bacon »

vic user wrote:everything i know about poker i learned from kenny rogers.

chris
You've gotta know when to hold'em, know when to fold'em, know when to walk away, know when to run... 8)
Bacon
-------------------------------------------------------
Das rubbernecken Sichtseeren keepen das cotton-pickenen Hands in die Pockets muss; relaxen und watschen die Blinkenlichten.
Post Reply