Poker Winning Hands

C# Poker Video game Pt6: Creating EvaluateHand course (analyzing poker hand)





C# Programming Obstacle: Poker Video game
C# Poker Video game Pt6: Creating EvaluateHand course (analyzing poker hand)

In this movie we produce approaches and comparisons to identify what poker hand the player and pc maintain.
We make use of arrays and if statements to accomplish comparisons of the cards versus official poker hand.

Learning to code? Comply with my C# tutorials for inexperienced persons. I do a good deal of C# programming issues and C# projects as aspect of my research – just about every working day!
If you are discovering to system, nothing beats solving authentic programming physical exercises and coding issues.
So really don’t forget about to subscribe, as I release new programming movies just about every working day!

Download Task Guidelines AND Ultimate Supply Files:

resource

6 comments

  1. 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?

    Reply
  2. Why the inheritance of the card class?

    Reply
  3. 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;
    }

    Reply
  4. 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)

    Reply
  5. 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.

    Reply
  6. 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.

    Reply

Have your say