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
Comments
http://paypal.me/parallaxitems
I need to get one of those badges, or better two, like ken said...
Mike
A determined coder can write COBOL programs in any language. -- Author unknown.
Press any key to continue, any other key to quit
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
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.
"We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
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