Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Need help doing math about a card game  (Read 975 times)

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Need help doing math about a card game
« on: September 02, 2009, 03:30:00 pm »

I'm designing a card game that uses regular-ish playing cards and relatively simple rules.
Basically, the game comes down to comparing sets of cards (a "play", made up of 1-5 cards). Four players are dealt 16 cards each from a 160-card deck (the deck has 8 suits and 20 ranks, these being Spades, Swords, Cups, Hearts, Clubs, Wands, Coins, and Diamonds, and A, 2-15, Page, Jack, Bishop, Queen, and King), and then take turns paying a small ante and putting down a "play". This play must rank higher than the previous play or else the player must fold. The last player then wins the collected pot.

Now, for my test runs, I've used poker rules for hand ranks, but I wanted to base the final rules on real math. So, I want to see how likely each kind of hand is and rank them in that order.

However, I'm not entirely sure how to do this.
The basic question is: how can I quickly figure out how likely one is to get at least one pair when you draw 16 cards from the 160-card deck?

These are the valid plays I've come up with:
One High-card
One Pair
3-Card Flush (three cards of the same suit)
3-Card Straight (three cards in rank order)
3-Card Straight Flush
3-Count (three of a kind)
Two Pair (total of four cards)
4-Card Flush
4-Card Straight
4-Card Straight Flush
4-Count
Full House (three of a kind AND two of a kind)
5-card Flush
5-card Straight
5-card Straight Flush
Royal Straight in Spades (as in poker, highest possible rank, suit, and play)

It is noteworthy that when you put down a play, those cards leave your hand and cannot be used again but if, for instance, you play a high card, you only loose one card. Thus, the best strategy is usually to start with a low play and work your way up over several plays, so everyone has to ante several times, thus increasing the pot. You must balance saving high cards for the final play and responding to other player's actions.
Logged
A thousand million pool balls made from precious metals, covered in beef stock.

Mephansteras

  • Bay Watcher
  • Forger of Civilizations
    • View Profile
Re: Need help doing math about a card game
« Reply #1 on: September 02, 2009, 04:12:21 pm »

I'm sure there is a real math way to do it, but personally I'd just program a quick script to go through and find valid configurations. Run it a few thousand times and have it figure out the % and you're good.
Logged
Civilization Forge Mod v2.80: Adding in new races, equipment, animals, plants, metals, etc. Now with Alchemy and Libraries! Variety to spice up DF! (For DF 0.34.10)
Come play Mafia with us!
"Let us maintain our chill composure." - Toady One

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: Need help doing math about a card game
« Reply #2 on: September 02, 2009, 09:40:26 pm »

mmm... you need to study probability...  :P

Meph's brute force approach might be sufficient to get a general idea.

n!/((n-p)!*p!)

is the "combination" (I'm not sure if that is the correct translation) function to get what you need.  That would be all the possibilities for a certain amount of elements (ranks = p) with a number of cards in your hand (n )

so you need to divide the amount of CORRECT results (that would be pairs) by the total possible combinations and you have your percentages.

Hope it helped.

Advice:  Go to a reliable source and learn a bit about probability.   ;)
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

Muz

  • Bay Watcher
    • View Profile
Re: Need help doing math about a card game
« Reply #3 on: September 03, 2009, 01:52:13 pm »

Yup, statistics is vital for game design. But Wikipedia has a nice table on it.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: Need help doing math about a card game
« Reply #4 on: September 03, 2009, 07:34:12 pm »

cool wiki... I'll check it out sometime....  :)
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.