|
Features

Statistically Speaking, It's Probably a Good Game, Part 1: Probability for Game Designers
Great, we’re off to the races! Only problem is, how can we easily calculate the total chance of flipping a heart, accounting for both cards? It would be easy to make the mistake of assuming that it would be 9/47 + 9/46. Not true, however. This is the same mistake that can lead you down the dark path of believing that the chance of rolling a “6” on a six throws of the dice is 1/6 + 1/6 + 1/6 + 1/6 + 1/6 + 1/6 = 1.0 = 100% = SureThingTM. Unfortunately, there is not a 100% chance of rolling a “6” on six throws of a die***.
Turns out that the solutions to both of these problems are made easier by using converse probability. We must ask “what are the chances we won’t draw a heart?” For the first card (the turn), the answer is (47 - 9)/47 = 38/47. For the second card (the river), the answer is (46 – 9)/46 = 37/46. From a study of conditional events (see earlier in this article), it’s easy to calculate the chances of BOTH of these events happening. In other words, we must calculate the chance that no hearts are drawn on either card. This is just the product of 38/47 x 37/46 = 65.0%. Since we are actually interested in the chances of making the flush, we just subtract this result from 1.0 to get it. 1.0 – .65 = .35 = 35% So there is a 35% chance of drawing the flush. Now do you go all-in?
***Note: the answer to the little dice problem is figured out the same way. The chance of rolling at least one “6” in six throws is found by looking at the chance of rolling no “6”s. On each throw, the chance of no “6”s is 5/6. Cumulatively, in order for no “6”s to come up in six throws, the chance is just the product of all six throws: 5/6 x 5/6 x 5/6 x 5/6 x 5/6 x 5/6 = .33 = 33%. So, the chance of at least one “6” coming up is 1.0 – .33 = .67 = 67%. Thus, you should see at least one “6” on six throws about 2/3 of the time. Now go use this to make money off somebody.
I didn’t mean to get all “mathy” above, and I was a little sneaky with my blitzkrieg treatment of Hold’em odds. The important thing to remember about converse probability is that sometimes it’s much easier to figure out the chance of something NOT happening than it is to figure out whether it WILL.
An Aside on Random Number Generators
Another thing all digital game designers should know about probability: random number generators are not random! Random number algorithms require a “seed number,” which is a base from which the algorithm can get all medieval on itself and do gyrations that ultimately result in a seemingly-random number. Most of the time, programs sample the CPU clock time or something similar to use as the seed number — this helps the algorithm be pretty darn random. But for high-intensity games with tons and tons of random number generations, sometimes that’s not random enough. Take for example online poker providers. Players (who often gamble for real money) need to know unconditionally that there are no underlying patterns to the random numbers that control card shuffling. In extreme cases like this where money is riding on the outcome, programmers must get super-fancy and start doing things like using CPU heat and entropy as seed numbers instead of clock times.
The take-home here is just that digital games don’t have truly random numbers. Most of the time, that’s fine, but if your game crunches insane amounts of numbers, then beware of patterns.
|