Four Of A Kind Poker

Four Of A Kind Poker Rating: 6,4/10 6707 votes
  1. 4 Of A Kind Bonus Poker
  2. Four Of A Kind Poker Hand

Hello!

Four of a kind means you hold four of the same card, such as 8-8-8-8 with maybe a random 5 or something else thrown in there for your fifth card. Not bad, not bad at all. If you're masterful at bluffing and you can get others to fold, this could easily bring home the pot. Four of a Kind Bonus Poker is a video poker game that plays very similar to the classic Jacks or Better video poker game in most ways. The paytable is the same and there are no wild cards or jokers involved, so one could easily be tricked into thinking they are playing Jacks or Better.

You’ve seen the pair (two of a kind), three of a kind, so guess what’s coming next?

Yep… four of a kind! (:

Programming the match for this hand is very similar to that of a three of a kind.

Ok first, you can review the poker hands that have already been covered by following any of the links below:

  • Four of a kind (you are here)
  • Royal flush (an ace-high straight flush)
Setup
Free crazy 4 poker online

Before we begin writing the main code, here are some data structures you’ll be using. They are briefly discussed here, but if you’d like the full details, check out this link. Otherwise, if you’d like to skip ahead, please click here.

Card values
Card suits
Card
Hand

A “hand” is not a custom data structure like the ones above, but an array of Card objects:

Writing The Code To Identify A Four Of A Kind

A four of a kind is similar very much like a three of a kind. We’re looking for four cards of the same value (rank) instead of three.

First, sort the cards by their rank, in descending order. We previously defined a “utilities” file, named CardMatchUtils.js, and added a function to it called, CardMatchUtils.SortCardsByDescendingValue, which can perform the sorting. If you’re just joining this series, CardMatchUtils.js is a file that is shared by all the poker hand matching functions, because it contains a several functions that they all use. CardMatchUtils.SortCardsByDescendingValue is one of those functions, because sorting a hand by the ranks of its cards in descending order helps to make the poker hand matching much easier.

The CardsHaveSameValue utilities function, previously written here, determines if a certain number of cards in the hand have the same rank. In this case, we want to check for four cards.

We’re also using the “wild card”, which is a card that can assume the rank of any card. So, the following hand would also qualify as a four of a kind:

After sorting the cards by their card rank in descending order, the hand looks like:

There are a pair of fives already, and the two wilds will assume another pair of fives.

The pseudocode for matching a four of a kind looks like:

The CardsHaveSameValue function does most of the work here, and you can review that function to see how it functions.

Build Your Own Hand

You can use the controls below to create your own hand to see if it is a four of a kind. It will also recognize previous poker hands we’ve covered up to this point. Have fun playing around with it!

Result:

If you have any questions about recognizing a four of a kind, or the above interaction, please let me know at cartrell@gameplaycoder.com.

That’s all for this article. Thanks, and stay tuned as this series continues!

– C. out.

Contributed by William Moore of NY state, who says that it was 'introduced' in a 'family poker night' in the late-1950's (maybe '57 or '58), and became a rather popular addition to the games played. He taught to college friends in the late 1960's, but the regular Draw & Stud Poker games remained more popular with them.

Introduction

This game is for four or more players (best for six to eight players), using a 52 cards pack (no jokers). Although it is not strictly a type of Poker, it is typically played as an option in 'dealer's choice' poker.

Ace is always ranked high, above the king. The object is to collect 4 of a kind (four cards of the same rank) or to have the lowest hand when someone else achieves this. Each of these players wins half the pot.

Initial deal and betting

Each player places the agreed ante into the pot. The cards are shuffled and cut, and each player is dealt one card face up. These cards must all be of different ranks. If a player is dealt a card equal to one already held by another player, that duplicate card and all remaining cards are re-shuffled and another card is dealt to the remaining players, until each player is holding a different card.

When each player is holding a different card, first betting round begins. The player holding the highest card begins and can 'check' or 'bet'. If no one has bet yet, other players can check or bet. After a bet, players can either call or raise the bet or fold. The betting round continues until either everyone has checked, or the last bet or raise has been called by all players who have not folded.

For those not familiar with this form of betting, which is the same as in poker:

  • The ante is a fixed stake paid to the pot by all players before the deal.
  • When you check, you let your current stake in the pot (which is already equal to all the other player's stakes) stand as it is.
  • When you bet or raise, you add an extra stake to the pot. A minimum and maximum bet/raise should be agreed in advance.
  • When you call, you put enough money into the pot to make your stake equal to the highest amount contributed by any other player.
  • When you fold, you drop out of the play for that deal, and abandon whatever money you have contributed to the pot.

The betting round ends as soon as the stakes of all players who have not folded are equal.

In this game there is a limit of three raises per betting round. That is, after there has been a bet and three raises, no one can raise further. The only options then are to call or to fold.

This is a family game, played for small stakes - for example a nickel (5 cents) ante and bets and raises of a nickel or a dime would be typical.

Continuation of play and winning

Then, play continues. The dealer turning cards from the top of the undealt deck, one at a time. If the turned card matches a card held by a player, the card is given to that player. Each time a player acquires an extra card, the highest hand begins a new round of betting, as above. If the card doesn't match anyone's card, it is discarded, and the next card from the top of the deck is turned.

Play continues: turning the top card; giving it to the player who holds that / those cards, or discarding it and turning the next card. (Players who have folded are out of the game and do not receive any more cards.) There is a new betting round whenever a player 'receives a card' equal to the card(s) they're holding).

4 Of A Kind Bonus Poker

The deal ends when a player has collected 'Four of a Kind'. At this point the High hand and Low Hand divide the pot as equally as possible between them (any odd amount going to the high player). The player holding the 'Four of a Kind' will be high. The low hand is that of the active player holding fewest cards. In case of a tie the lower card(s) take the 'low' half of a pot. For example the low hand may be the lowest single (un-paired) card, or the lowest 'pair' if everyone has 'matched a card' - maybe even the lowest 'triple' if everyone has three matching cards. Remember that aces are always high.

Four Of A Kind Poker Hand

Note: If you currently have the lowest hand you hope that another player will win quickly (while you can participate in the winnings, too). The only time you have a sure win is when you hold the lowest 'Triple' when everyone has three matching cards. If you get a matching card you are high, and if another player matches you are low. The second lowest player hopes that the lower hand will 'match' another card.