Determining and Simulating Card Game Probabilities

Опубликовано: 04 Март 2026
на канале: Bradley Sward
185
7

Let's play a card game with rules and algorithms shown in the video along with this description:

There are 16 total cards found as a deck of cards
There are 4 types of cards in the deck (A, B, C, D)
For each type of card, there are 4 identical copies of it in the deck
So let's say the deck always starts with 16 cards AAAABBBBCCCCDDDD

This is not the most elegant way to play the game, but it is something that makes the problem more understandable

Randomly shuffle the deck of cards
While there are still cards left in the deck:
    First pick a card randomly from the deck, let's call it X
     Follow this loop up to three times:
         Pick a card randomly from the deck, let's call it Y
        If X and Y are not the same card type, then the game is over and you lose immediately
    End Follow Loop
End While Loop
If you make it here and you haven't lost yet, then you have won the game!

What are the odds of winning the game? In other words...
If we played this game forever and ever, and you bet $1 each time we started a new game...
What would I need to pay you each time you won the game, so that we both break even?

Bradley Sward is currently an Associate Professor at the College of DuPage in suburban Chicago, Illinois. He has earned a Masters degree in Software Engineering from DePaul University, a Masters degree in Computer Science from the University of Illinois at Springfield, and two Bachelors degrees in Computer Science and Molecular Biology from Benedictine University. Prior to teaching, Bradley worked for five years in the field of casino gaming on a variety of video slot machine and poker games. The Village People have been permanently etched into his brain.