Skip to main content

Section 🎲 Dice Poker

This section outlines the structure and rules you will implement for a simple Dice Poker program in MATLAB.

Subsection Dice Poker Ranks

There will be 8 primary ranks in Dice Poker.
Table 12. Dice Rank IDs, Names, & Descriptions
Description
Example
five-of-a-kind
all five dice show the same face value
four-of-a-kind
four dice show the same face value
straight
five consecutive values (e.g., 1-5 or 2-6)
full-house
three-of-a-kind plus a pair
three-of-a-kind
three dice show the same face value
two-pair
two distinct pairs
one-pair
a single pair
singles
no other pattern; highest single die decides

Subsection Typical Round

A single round of dice poker plays out in the following seven phases:

Phase 1. Dealer’s Initial roll.

Phase 2. Player’s Initial roll.

Phase 3. Dealer Selects Dice to Reroll.

The dealer selects up to 5 dice to re-roll to improve their roll.
The dealer selects to reroll dice in positions 3, 4, and 5.

Phase 4. Dealer Rerolls chosen Dice.

Rolling dice in positions 3, 4, and 5, the dealer rolls:
The dealer’s first and second rolls are:
The second roll represents the dealer’s new current β€œhand”.

Phase 5. Player Selects Dice to Reroll.

The player selects up to 5 dice to re-roll to improve their roll.
The player selects to reroll die in position 5.

Phase 6. Player Rerolls chosen Dice.

Phase 7. Determine Round Winner.

To determine a winner, we compare the dealer’s and player’s second roll. The second roll with the better rank wins.
In this case, the dealer’s hand has a better rank, so the dealer wins the round.

Subsection Face Counts

A useful piece information in this game will be the counts of each face value in a roll.
For example, suppose a roll consists of the following dice:
In your program, such a roll would be represented as the 1 x 5 vector:
roll = [1 2 3 3 3]
Since the roll contains one 1, one 2, zero 3’s, zero 4’s, three 5’s, and zero 6’s, the face value counts for this roll would be given by the 1 x 6 vector:
counts = [1 1 0 0 3 0]
%         1 2 3 4 5 6  <- the indices are the face values
where the locations/indices are the face values.

Subsection Determining a Winner

The winner is the roll with the lower (better) rank number in the table above. If the ranks are identical, you must compare appropriate tie-breakers that depend on the shared rank. As a rule of thumb, the more matches of a face value, the more powerful those dice are in breaking ties.
The following table summarizes the the tie-breaking strategy. The dice in green determine the winner.
TIED RANK
TIE-BREAK
EXAMPLE
five-of-a-kind
highest die value wins
four-of-a-kind
Highest four-of-a-kind die wins.
If still tied, highest single die wins.
full-house
Highest three-of-a-kind die wins.
If still tied, highest pair die wins.
straight
The 2-6 stright beats the 1-5 straight
three-of-a-kind
Highest three-of-a-kind die wins.
If still tied, highest single die wins.
two-pair
Highest pair die wins.
If still tied, 2nd highest pair die wins.
If still tied, highest single die wins.
one-pair
Highest pair die wins.
If still tied, highest single die wins.
singles
Highest single die wins.

Example 13.

Full House Scenario (first priority: the triples)
dealer = [3 3 3 6 6];   % full house (triple 3s)
player = [5 5 5 2 2];   % full house (triple 5s)
Both are full houses, but the player’s triple is higher (5s vs 3s), so the player wins.

Example 14.

Two Pair Scenario (highest pair first)
dealer = [6 6 4 4 1];   % two pair (6s and 4s), kicker 1
player = [6 6 3 3 5];   % two pair (6s and 3s), kicker 5
Both have top pair 6s. Compare the second pair: dealer has 4s vs player’s 3s; dealer wins without checking kickers.