Shop OBEX P1 Docs P2 Docs Learn Events
Draw Poker WX — Parallax Forums

Draw Poker WX

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:
20181105_150635.jpg

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

  • What a neat project!
  • Oh Mike this is really cool.

    I need to get one of those badges, or better two, like ken said...

    Mike
  • WhitWhit Posts: 4,191
    @iseries - Mike - what a cool project!

    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.
  • Regarding 128x64 screens, I have some driver laying around for adapting code written for them to TV output. NTSC and PAL60, standard aspect ratio or widescreen. But it is currently set up for 4 colors (as it was written to replace LameLCD and its temporal dithering), so switching to 2 colors during active video would need some extra work...
  • Just updated this project:

    Added user input for moving the cursor around and also selecting hold card or not. Also display current points.

    Mike
  • The project is now complete with the addition of points scored and displaying the winning hand.

    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
  • It's getting close to Christmas time and decided to take a look at the BlockyProp Badge WX unit again.

    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
Sign In or Register to comment.