473,797 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4687
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******** *************** ***********@d45 g2000hsc.google groups.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.comwr ote:
<teeja...@gmail .comwrote in message

news:fc******** *************** ***********@d45 g2000hsc.google groups.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**********@b1 g2000hsg.google groups.com:
Did you develop Cards.dll?
Card.dll is included with Windows.

--
sp**********@ro gers.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...@com cast.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********@com cast.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.publi c.dotnet.langua ges.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
4100
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. I was too lazy to sit down with paper and pen to figure out how much the second choice came out to. But now I'm learning python and just learned about recursive functions and iteration, I figured I'd use those theories to figure out the problem....
8
1612
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 thinking is that since the unary operator has higher precedence than || , it will be evaluated before || in any
1
4487
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 hand(eg. how many cards do I need to get a Flush) and then calculate the odds based on those numbers. My problem is that I do not know how I should find the missing cards. One way I could do it is to use programming logic like this
2
2406
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 stored in a game DB. It is a very cool project with Pattern Recognition (Pixel Screen SCraping to OCR) and pretty advanced calculations. I just started writing my first prototype in C# and discovered that I could not set a System Wide CBT hook....
27
5631
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 Python program is given in the discussion page for doing it that way. I wanted to take a different approach and actually generate all the possible hands, counting the number of each type. It's quite do-able on today's hardware, with 5-card...
4
8915
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
1370
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 I have also tried many different variations. Dim response As HttpWebResponse = request.GetResponse() 'Get the response stream Dim reader As StreamReader = New StreamReader(response.GetResponseStream)
13
2558
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 results with 1 million hands: Number of hands generated : 1000000 Straight Flush : 0.0012 % In theory : 0.0012%
24
7085
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 5 cards but the problem is that there is 5 flop cards and 2 cards that the player has in hand. I don't even know how to start that .... (identify cards by numbers? 1 to 52) or (identify them by both numbers and suits) Any suggestion will be...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10205
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9063
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.