TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
lee croydon
NA
48
12k
test 2 equal poker hands for highest card to determine winni
Nov 21 2014 10:06 AM
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.
Reply
Answers (
10
)
check the user already exists or not
interface and abstract difference