Learn Poker Video Source & Info:
C# Programming Challenge: Poker Game
C# Poker Game Pt6: Creating EvaluateHand class (evaluating poker hand)
In this video we create methods and comparisons to determine what poker hand the player and computer hold.
We utilize arrays and if statements to perform comparisons of the cards against official poker hand.
Learning to code? Follow my C# tutorials for beginners. I do a lot of C# programming challenges and C# projects as part of my homework – every day!
If you are learning to program, nothing beats solving real programming exercises and coding challenges.
So don’t forget to subscribe, as I release new programming videos every day!
DOWNLOAD PROJECT INSTRUCTIONS AND FINAL SOURCE FILES: http://www.codinghomework.com/?p=667
Source: YouTube
Your way of checking for FourKind is slightly complicated. If the cards are sorted before checking than simply compare the 1st with the 4th card (or the 2nd with the 5th card) … Cause if Card1 == Card4 then Card2 and Card3 must be of the same value.
All this can do is tell you what hand you have. However, no logic to determine who has the higher pair and kicker or anything like that. When you use the word ( Hand Evaluation ) In the title of the video, it's no good leaving us short. I myself am up to this stage, and although I've used slightly different ( more efficient ) ways to determine the hand, I'm struggling with the evaluation. I'm currently multiplying the prime numbers of each card. However, this falls short on Three of a Kind, Two Pair, One Pair and High Card. However, it's a quick fix for the rest.
you missed the straight flush, but that's fine, this is exactly what I need, although in python (haven't watched the vid yet, but I'm assuming I can pull some ideas at the very least)
Extra code to check for a wheel straight: add this else-if statement in the Straight() method:
// checking for the wheel
else if ((int)cards[3].MyValue == 5 && (int)cards[4].MyValue == 14 &&
cards[3].MyValue – 1 == cards[2].MyValue &&
cards[2].MyValue – 1 == cards[1].MyValue &&
cards[1].MyValue – 1 == cards[0].MyValue)
{
handValue.Total = (int)cards[3].MyValue; //this should of course be 5
return true;
}
Why the inheritance of the card class?
Hey I recently started to develop a Texas-holdem poker game for my school project. I was wondering how I could determine a flush considering the program has to find the flush within seven possible cards and I was wondering if you have any idea of how this could be possible?