473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Help with Poker Hand Evaluation.

I am looking for some help!

I am currently developing a new game for an online community. The
game is called Pokino which ishalf bingo and half poker. Wierd eh?!

Anyway...

The final part of the program needs to evaluate two 5 card poker hands
and determine which one out of the two hands wins. I thought rather
than create a new class of my own I would see if there was anything
already available. I have searched high and low but can't find
anything!!

I am using Cards.dll so each card is represented by an integer value
ranging from 0-51.

If anybody knows of any resources that may help me or can come up with
a quick and easy way to do this it would be much appreciated.

Thanks in advance,

Tom Miller.
IT Development Analyst.
Jun 27 '08 #1
9 4665
Did you develop Cards.dll? I know when I was designing my own
Cards.dll I created the cards in two parts: Card Value and Card
Suit. When I had to do a War application for class I could simply
take the card value against the other card value and determine the
winner. For that particular assignment our professor also had one
suit beating another so I could just take the value of the suit (Spade
= 1, Heart = 2, Club = 3, Diamond = 4) and pit them against each
other.

All that being said I would define a Card object and simply shuffle
those around in an array to build your deck.

Jun 27 '08 #2
On 16 Apr, 14:38, "cfps.Christian" <ge0193...@otc.eduwrote:
Did you develop Cards.dll? *I know when I was designing my own
Cards.dll I created the cards in two parts: *Card Value and Card
Suit. *When I had to do a War application for class I could simply
take the card value against the other card value and determine the
winner. *For that particular assignment our professor also had one
suit beating another so I could just take the value of the suit (Spade
= 1, Heart = 2, Club = 3, Diamond = 4) and pit them against each
other.

All that being said I would define a Card object and simply shuffle
those around in an array to build your deck.
I use cards.dll that is part of Windows. The same dll that is used in
Solitaire and such like....

enum rank
ace
two
three
etc etc...
end enum

enum suit
heart
spades
clubs
diamonds
end enum

The cards are represented as follows:-
card = rank + suit * 4
Jun 27 '08 #3

<te******@gmail.comwrote in message
news:fc**********************************@d45g2000 hsc.googlegroups.com...
>I use cards.dll that is part of Windows. The same dll that is used in
Solitaire and such like....

enum rank
ace
two
three
etc etc...
end enum

enum suit
heart
spades
clubs
diamonds
end enum

The cards are represented as follows:-
card = rank + suit * 4
You would be better served to extend that class and add a method that
returns the split up rank and suit for a poker-style game, since ranking
poker hands is easier that way. Also what if you want to add Jokers to the
deck or handle wild cards? The OP didn't specify, but doesn't sound
possible with cards.dll.
Jun 27 '08 #4
On 16 Apr, 15:14, "Mike C#" <x...@xyz.comwrote:
<teeja...@gmail.comwrote in message

news:fc**********************************@d45g2000 hsc.googlegroups.com...


I use cards.dll that is part of Windows. *The same dll that is used in
Solitaire and such like....
enum rank
ace
two
three
etc etc...
end enum
enum suit
heart
spades
clubs
diamonds
end enum
The cards are represented as follows:-
card = rank + suit * 4

You would be better served to extend that class and add a method that
returns the split up rank and suit for a poker-style game, since ranking
poker hands is easier that way. Also what if you want to add Jokers to the
deck or handle wild cards? *The OP didn't specify, but doesn't sound
possible with cards.dll.- Hide quoted text -

- Show quoted text -
I decided at the outset that I wasn't going to add functionality to
deal with jokers/wild cards.
So create a method that would determine both rank and suit as seperate
objects/variables and use those to determine the poker hand?
Jun 27 '08 #5
"cfps.Christian" <ge*******@otc.eduwrote in news:a8b28587-c5d9-4d09-855b-
88**********@b1g2000hsg.googlegroups.com:
Did you develop Cards.dll?
Card.dll is included with Windows.

--
sp**********@rogers.com (Do not e-mail)
Jun 27 '08 #6
te******@gmail.com wrote:
>
I decided at the outset that I wasn't going to add functionality to
deal with jokers/wild cards.
So create a method that would determine both rank and suit as seperate
objects/variables and use those to determine the poker hand?
It doesn't seem like a difficult thing to write the code for evaluating hands,
if you like programming. :)

I would not worry about speed, and do it in a very methodical way. For instance,
you could have a separate procedure for each kind of hand: IsFlush, IsStraight,
IsFour, IsFullHouse, IsThree, etc. The first thing when comparing two hands is
to see if one is a higher rank of hand than the other.

If they are the same rank, i.e. both are TwoPair, then you need to compare card
values in each hand. I would use a separate procedure for comparing two flushes,
two straights, two TwoPair hands, etc.

If you break it down, you can write very clean tests for each possibility, and
get a very reliable evaluator. No matter how elaborate the code looks, it will
be very fast in use, so don't worry about that.
Jun 27 '08 #7
On 16 Apr, 16:06, "Steve Gerrard" <mynameh...@comcast.netwrote:
teeja...@gmail.com wrote:
I decided at the outset that I wasn't going to add functionality to
deal with jokers/wild cards.
So create a method that would determine both rank and suit as seperate
objects/variables and use those to determine the poker hand?

It doesn't seem like a difficult thing to write the code for evaluating hands,
if you like programming. :)

I would not worry about speed, and do it in a very methodical way. For instance,
you could have a separate procedure for each kind of hand: IsFlush, IsStraight,
IsFour, IsFullHouse, IsThree, etc. The first thing when comparing two hands is
to see if one is a higher rank of hand than the other.

If they are the same rank, i.e. both are TwoPair, then you need to compare card
values in each hand. I would use a separate procedure for comparing two flushes,
two straights, two TwoPair hands, etc.

If you break it down, you can write very clean tests for each possibility, and
get a very reliable evaluator. No matter how elaborate the code looks, it will
be very fast in use, so don't worry about that.
Thanks mate!
Jun 27 '08 #8

"Steve Gerrard" <my********@comcast.netwrote in message
news:Je******************************@comcast.com. ..
te******@gmail.com wrote:
>>
I decided at the outset that I wasn't going to add functionality to
deal with jokers/wild cards.
So create a method that would determine both rank and suit as seperate
objects/variables and use those to determine the poker hand?

It doesn't seem like a difficult thing to write the code for evaluating
hands, if you like programming. :)

I would not worry about speed, and do it in a very methodical way. For
instance, you could have a separate procedure for each kind of hand:
IsFlush, IsStraight, IsFour, IsFullHouse, IsThree, etc. The first thing
when comparing two hands is to see if one is a higher rank of hand than
the other.

If they are the same rank, i.e. both are TwoPair, then you need to compare
card values in each hand. I would use a separate procedure for comparing
two flushes, two straights, two TwoPair hands, etc.

If you break it down, you can write very clean tests for each possibility,
and get a very reliable evaluator. No matter how elaborate the code looks,
it will be very fast in use, so don't worry about that.
I would advise going even a small step further and creating a generic
GetHandScore routine to call all of those hands and assign a rank to each
hand. So a Royal Flush would be worth 10,000 points, Straight Flush = 9,000
points, Four of a Kind = 8,000 points, and so on down the line. You could
also add a GetHighCard routine to determine the high card in your straight,
flush, full house, etc., in case two players both have a straight or full
house. Then determining who won is simply a matter of comparing the scores
returned by GetHandScore, and comparing GetHighCard in case of a
GetHandScore tie. Like Steve pointed out, this isn't that difficult. The
lower level comparisons you need to do would be easier if you split up the
rank and value of each card, which was why I mentioned that before.
Jun 27 '08 #9
Go to PSC, here:
http://www.planet-source-code.com/vb...60163&lngWId=1

for a program I wrote (or highly modified, I forget) which deals and
evaluates poker hands.

Mike

On Wed, 16 Apr 2008 06:31:48 -0700 (PDT), in
microsoft.public.dotnet.languages.vb "te******@gmail.com"
<te******@gmail.comwrote:
>I am looking for some help!

I am currently developing a new game for an online community. The
game is called Pokino which ishalf bingo and half poker. Wierd eh?!

Anyway...

The final part of the program needs to evaluate two 5 card poker hands
and determine which one out of the two hands wins. I thought rather
than create a new class of my own I would see if there was anything
already available. I have searched high and low but can't find
anything!!

I am using Cards.dll so each card is represented by an integer value
ranging from 0-51.

If anybody knows of any resources that may help me or can come up with
a quick and easy way to do this it would be much appreciated.

Thanks in advance,

Tom Miller.
IT Development Analyst.
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Jakle | last post by:
I was at a job interview one day and the owner of the start up company asked me if I'd rather make $1000 dollars a day, or start off with a penny a day and double the amount every day for 30 days....
8
by: manan.kathuria | last post by:
hi all , the expression in question is ++i&&++j||++k most sources say that since the result of the || operation is decided by the LHS itself , the right side is not computed my point of...
1
by: Martin Olsen | last post by:
Hi all. I am creating a program which calculates poker odds. The program should look at the visible cards (those on your hand and those on the table) then count the cards needed to improve the...
2
by: andyblum | last post by:
I hope you can answer a question. I am writing a poker utility that tracks what windows are open and displays information about opponents that are still playing and their previous history that is...
27
by: Simon Biber | last post by:
I was reading http://en.wikipedia.org/wiki/Poker_probability which has a good description of how to count the frequency of different types of poker hands using a mathematical approach. A sample...
4
by: hardieca | last post by:
Has anyone heard of an open-source .NET engine that calculates the winning and losing percentages of hands? Regards, Chris
4
by: Mark Cooney | last post by:
OK this might be long winded by want to show you everything I am doing. Down below is the result I get from an API Call to a website called Betfair. The following is some code I am trying, but...
13
by: kinghippo423 | last post by:
Hello Everyone, I did a poker program in Java that essencially finds the strenght of a poker hand created Randomly. My program is doing OK...but I'm pretty sure it can be optimised. This is my...
24
by: bnashenas1984 | last post by:
Hi every one I'm trying to make a little poker game but I don't know how to evaluate the strength of a 7 card hand.. It's not that hard with 5 cards. Actually I found some program to do that with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.