Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make an array that contains all possible poker texas holdem hands starting with the best "royal straight flush" and then moving down.

I can't figure out how to add all "full house" combinations to the array.


This is how I added the royal straight flush to the Ranking array:
C#
string[] suits = { "s", "c", "d", "h" }; 
string[] highcard = { "A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2" }; 
//Add Royal Straight Flush to Ranking array 

foreach (string x in suits) 
{ 
    Pokerbot.Ranking.Add("A"+x); 
    Pokerbot.Ranking.Add("K"+x); 
    Pokerbot.Ranking.Add("Q"+x); 
    Pokerbot.Ranking.Add("J"+x); 
    Pokerbot.Ranking.Add("T"+x); 
}

How do I loop through all full house combinations starting with the best, and add them to the Ranking array?
Posted
Updated 24-Nov-15 11:53am
v3

1 solution

I think it is the wrong way.
from what I see, you can't deal with equal hands in your array.

I would build a function that would return the ranking of the hand.

[Update]
I would do something like
C#
float RabkHand(hand Hand) {
    float Rank;
    if ((Ranf= Chk...(Hand)) != 0) {}
    elseif ((Ranf= Chk...(Hand)) != 0) {}
    else
        Rank= ChkNothing(Hand);
    return Rank:
}

Each Chk... is a function checking a given hand and returning the ranking of the hand.
 
Share this answer
 
v2
Comments
Member 11380736 25-Nov-15 11:40am    
I have a function that returns the ranking of the hand. But it finds it inside the array I'm trying to create, by searching inside the array.
Do you have any idea how to loop through all possible full house combinations like As,Ad,Ac,Ks,Kc etc.
Patrice T 25-Nov-15 19:39pm    
The way you build the array is wrong because you say that a hand with 1 suit is better than the same hand with another suit.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900