Domanda

I've written a Naive Poker Evaluation algorithm for a Hold 'Em Poker game I'm developing and I'm wondering what would be the best way to evaluate Jokers within these hands.

A thought I had would be to replace the joker with each card from the deck and reevaluate the hand iteratively to find the best possible hand. However there can be upto 3 jokers and it doesn't seem to be the most efficient way to do this? Thoughts?

P.S. - Yes I am aware that there are several faster poker hand evaluators available but these cards are slightly different and I have been unable to find one to suit my needs(Jokers etc), hence have written one from scratch.

È stato utile?

Soluzione

Note that to try every combination of five cards from seven means trying 21 combinations, which isn't so bad.

For each of the hands, #: where # is a number indicates the # jokers in hand case.

Also note that once you've found a hand, you don't have to look for hands that are worse than that in any of the other combinations out of seven cards - you can stop early.

You can form a straight flush if:

0: All of the cards are the same suit and the highest and lowest card have a difference of 4 (which implies the other three cards must be in between those)

1: All of the non-jokers are the same suit and the highest and lowest card have a difference of 4 or 3. (which implies the other cards fill in the straight, with one gap - which the joker fills)

2: All of the non-jokers are the same suit and the highest and lowest card have a difference of 4, 3 or 2.

3: All of the non-jokers are the same suit and the highest and lowest card have a difference of 4, 3, 2 or 1.

You can form a four of a kind if:

0: You have four cards the same rank.

1: You have three cards the same rank.

2: You have two cards the same rank.

3: You have a four of a kind - stop evaluating.

You can form a full house if:

0: You have a three of a kind and a pair.

1: You have a three of a kind, or you have two pairs.

2: You have a three of a kind, or you have a pair.

You can form a flush if:

All non-jokers are the same suit.

You can form a straight if:

See straight flush logic but take away the flush requirement.

You can form a three of a kind if:

0: You have three cards the same rank.

1: You have two cards the same rank.

2: You have a three of a kind - stop evaluating.

You can form a two pair if:

0: You have two cards the same rank, for two different ranks.

1: You have two cards the same rank (one pair).

You can form a pair if:

0: You have two cards the same rank.

1: You have a pair - stop evaluating.

You have highest card - stop evaluating

Altri suggerimenti

This logic of comparing top-bottom differences doesn't work.

Consider that you have 9 - J - J - K - Joker. That would yield a difference of 4 but is not a straight.

FIX: The non-joker numbers all have to be different as well.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top