Draw Poker WX
iseries
Posts: 1,495
Draw Poker for Badge WX
The Badge WX unit and the original eBadge have a 128X64 screen that is large enough to display cards on them.
So I had the idea of building a Draw Poker program patterned after a unit I had laying around at home.
The first thing that I needed to do was build a deck of cards to display on the screen. The cards are 24X32 in size so I broke out my paint program and started making some cards.
I then created a Visual Studio C# program to read in the PNG file and convert it to 32 bit encoded data that could be used by the C program on the BadgeWX unit. So each card takes up 24 words times 53 cards or about 5K bytes of data.
To display the card is just a mater of converting back each pixel bit in each word.
Next I need to build the logic to allow selecting cards to keep and keep track of the winnings.
Rules are:
Show 5 cards and allow picking which cards to keep and allowing a second roll.
Each roll cost 5 points.
Winnings are calulated as follows:
Jacks or Better - 5, 2 Pair - 10, 3 of a kind - 15, Straight - 20, Flush - 25, Full House - 40, 4 of a kind - 125, Straight Flush - 250, Royal Flush - 5000.
Winnings could be negitive.
Winnings could be made to persist....
Sample display:
Here is a link to the code so far. I wrote my own display library but you could use the one included with the BadgeWX with some changes. I also have a custom timer library that helps with displaying things in a timely manner. They are included in the Custom folder.
Github DrawPokerWX
Mike
The Badge WX unit and the original eBadge have a 128X64 screen that is large enough to display cards on them.
So I had the idea of building a Draw Poker program patterned after a unit I had laying around at home.
The first thing that I needed to do was build a deck of cards to display on the screen. The cards are 24X32 in size so I broke out my paint program and started making some cards.
I then created a Visual Studio C# program to read in the PNG file and convert it to 32 bit encoded data that could be used by the C program on the BadgeWX unit. So each card takes up 24 words times 53 cards or about 5K bytes of data.
To display the card is just a mater of converting back each pixel bit in each word.
Next I need to build the logic to allow selecting cards to keep and keep track of the winnings.
Rules are:
Show 5 cards and allow picking which cards to keep and allowing a second roll.
Each roll cost 5 points.
Winnings are calulated as follows:
Jacks or Better - 5, 2 Pair - 10, 3 of a kind - 15, Straight - 20, Flush - 25, Full House - 40, 4 of a kind - 125, Straight Flush - 250, Royal Flush - 5000.
Winnings could be negitive.
Winnings could be made to persist....
Sample display:
Here is a link to the code so far. I wrote my own display library but you could use the one included with the BadgeWX with some changes. I also have a custom timer library that helps with displaying things in a timely manner. They are included in the Custom folder.
Github DrawPokerWX
Mike
Comments
I need to get one of those badges, or better two, like ken said...
Mike
I am going to try to adapt the games @MattMatz_Parallax posted here for the Badge WX (first in C, then in BlocklyProp).
http://forums.parallax.com/discussion/169213/games-for-the-propeller#latest
I call one Badge WX - Blasteroids, and the other Badge WX - WeXman! I'll keep you posted! I think the rocker switches will work great for game control.
Added user input for moving the cursor around and also selecting hold card or not. Also display current points.
Mike
The only thing that maybe missing is flashing the winning cards or maybe flashing some LED's as to the results.
The unit doesn't have a speaker so can't make any noise which maybe a good thing.
The program does lack instructions on how to play though.
Mike
After playing a few hands of poker notice there was some scoring issues.
Found several errors in the logic and decided to correct them while I was at it.
Upload the new code on GitHub.
This is a great program for using bit data to display a result.
Mike