I am programming a game of 5 Card Poker, and an AI to play it. I have written a function that calculates, for a given card in a hand, the probability of improving the hand if this card is discarded and swapped for another random card dealt from the deck. As of now, the probability is calculated on the assumption that all other 47 cards are still in the deck. This will be refined at a later stage.
I now need to write a function that determines which, and how many (0, 1, 2, or 3) cards to discard from a hand.
- If I have the probability for each of the 5 cards, what is the best way to determine what combination (of up to 3) of these cards will give the largest possibility in improving the hand?
- What would be a suitable way to determine, based on this accumulated probability, if the cards should actually be discarded or not?
But the objective is not just to improve but to improve to the best hand.
A 2 has the same chance to improve as Ace
Improve to the best possible hand is also not correct as would always draw for a straight flush
As for what to discard. The cards that don't make the hand.
If you have to pay to continue then many hands should be folded