Sponsored By

The Complexity of Probability in Card Games

As card games become more expansive and complicated, we’re diving into a whole new level of complexity in probability theory.

Charlotte Walker, Blogger

April 3, 2017

5 Min Read

How do games determine which cards you get? It all comes down to probability.

When developing any type of game, you need to understand the probability of certain outcomes and how it can influence the user experience and sense of challenge. That's how you can tell how much you're actually risking.

When it comes to developing card games, probability becomes even more important. With the introduction of increasingly intricate and ever-expanding card games like Hearthstone and the Gwent card game, we’re seeing games of skill and expanding character knowledge combined with probability.

As card games intentionally become more expansive and complicated, we’re diving into a whole new level of complexity in probability theory.

Calculating Probability When Playing Games

Whenever there's an element of random chance, there's also a probability. When you flip a coin, there's a random set of "heads" or "tails" -- two separate options. That makes the probability of "heads" one in two and the probability of "tails" on in two (assuming a perfect coin). Simple, right? But it becomes more complex when your data sets and win conditions are more complex.

The higher the number of cards, the lower the probability and increase in complexity. In a standard deck, we have only 52 cards (Source)

Consider this. You've flipped a coin and it's landed on tails. You flip the coin and it lands on tails again. You flip the coin and it lands on tails a third time. Now a player will likely think to yourself "It can't possibly land on tails again!" But probability doesn't work that way. It doesn't take into account past performance. The odds of flipping heads or tails are still equal: one in two.

Probability calculations become quite complex, but at their core they just enumerate the different types of outcomes compared to the number of those outcomes that would be considered optimal.

Now compare the standard deck to Heartstone’s incredible 1054 cards (and growing)

Virtual Games and Probability Algorithms

So what determines which card you pull when you're playing a card game? What determines how dice roll? People are taught to think in terms of probability, but computers don't think this way. Great card games instead use randomness to decide each individual decision that is made. And this randomness will follow the rules of probability.

Of course, this mathematical component becomes even more complex when you’re considering a massive deck that can be composed of 1054 different types of cards, each with different powers, points and abilities to destroy your enemy’s cards.

This calculator attempts to understand the probability of acquiring an anticipated or topdeck card

Rather than considering that there is a "one in six" chance, a probability -based game simply asks a computer to give it a random number between one in six. It's similar to rolling dice, just in a virtual setting. That number that is returned has probability just as real dice do. Likewise, rather than considering what the probability is of a Jack being in any given position of a deck, the computer simply randomly shuffles all cards.

Of course, this relies upon the computer being able to produce a truly random number, which is often not entirely possible. Most computers cannot produce truly random numbers, but they can get random enough that it does not functionally matter. When computers are able to generate consistently random numbers, their probability will mirror real life games.

Probability Algorithms and the House Edge

For us to truly understand probability with card games, we also need to remember that most card games, particularly when involving the exchange of money or points, traditionally have a house edge. In Blackjack, the house edge is calculated to be about 1%, depending on the rules that are used. Slot machines can have can up to 15% house advantage. That doesn't mean that these games can't be won; it means that they aren't won consistently or by everyone.

Online casino games play with the concept of probability to develop a house edge

So one might think that a properly coded game would be a closed system, in the sense that players and the house would win or lose about 50% of the time. But that's not true because, of course, there are gaming businesses that need to make a certain amount of money.

If the house didn't have a small percentage of an edge, there would be no way that any large gaming company could stay in business. But computers aren't calculating that 0.28% of Blackjack players must lose. They are simply working out the mechanics of the game, and it is the mechanics of the game that affect the probability in this way.

Even Candy Crush plays with true odds – otherwise, their game wouldn’t be challenging enough and players wouldn’t be investing on more lives and tools.

Randomness is instead used as a mechanic of determining how games play out. Particularly, randomness is used to determine how cards are shuffled in card games. Though computers do generate some of the information, they generate this information at random, and the games play out mechanically the same as they would otherwise.

Thus, the same probability algorithms that apply to games in-person are going to apply to online games. You simply need to remember that the house does have edge.

Read more about:

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like