Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
10
Reply
test 2 equal poker hands for highest card to determine winni
lee croydon
Nov 21 2014 10:06 AM
1.1k
Reply
Hi all,
i am trying to find a way of testing 2 equal poker hands (for example: two hands with two pairs) to determine which one wins according to the highest ranked card.
i have already tested the hands to determine there rank (for example: three of a kind, two pair etc..)
the code i have so far for determining the best hand is as follows.
if (winningHand.Length <= 0)
{
winningHand = myHand;
bestHand = hand;
handRef++;
}
else if (allHandTypes[handRef] < allHandTypes[handRef - 1])
{
winningHand = myHand;
bestHand = hand;
handRef++;
}
else if (allHandTypes[handRef] == allHandTypes[handRef - 1])
{
}
}
which works well up until there are 2 hands of the same rank as explained above.
what i am trying to do is compare the hand in "bestHand" to the hand in "hand" if and when we get to the last "else if" statement, then if the hand in "hand" is better than the hand in "bestHnad" then replace "bestHand" with the hand in "hand" and add "myHand" to "winningHand" any help on this would be massively appreciated or just a point in the right direction.
Thank you in advance Lee.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
10
)
Next Recommended Forum
check the user already exists or not
interface and abstract difference