I used the game of Texas Hold'em using C #.
I wrote classes like Card, Deck, Player, Table, etc.
For instance:
Player player1 = new Player("player1"); player1.Card1 = new Card(4, Symbol.Clubs, true); player1.Card2 = new Card(5, Symbol.Clubs, true); Card card1 = new Card(4, Symbol.Clubs, true); Card card2 = new Card(7, Symbol.Hearts, true); Card card3 = new Card(2, Symbol.Spades, true); Card card4 = new Card(4, Symbol.Diamonds, true); Card card5 = new Card(4, Symbol.Clubs, true); Card[] tableCards = {card1, card2, card3, card4, card5};
I also wrote several methods for evaluating an array of maps, such as IsFlush, IsStraight, IsPair, etc.
My question is: how can I choose the best hand combination if I have 7 cards (2 hands, 5 from the table).
In this code example, this is {4,4,4,4,7}.
source share