游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

举例论述游戏设计蕴含的概率学原理

作者:Tyler Sigman

下面是答题时间!

问题1. 假设你正在设计一款全新MMORPG游戏,你设定当玩家消灭一只怪兽时,特殊道具Orc Nostril Hair将有10%的出现几率。某位测试者回馈称,他消灭20只怪兽,发现Orc Nostril Hair 4次,而另一位测试者则表示,自己消灭20只怪兽,没有发现Orc Nostril Hair。这里是否存在编程漏洞?

Orc Nostril Hair Follicle from gamasutra.com

Orc Nostril Hair Follicle from gamasutra.com

问题2. 假设你正在设计游戏的战斗机制,决定植入一个重击机制。若角色进行成功袭击(假设是75%的成功几率),那么他就可以再次发动进攻。若第二次袭击也成功,那么玩家就会形成双倍破坏性(2x)。但若出现这种情况后,你再次进行袭击,且这次袭击也获得成功,那么破坏性就上升至3倍(3x)。只要袭击都获得成功,你就可以继续发动新的进攻,破坏性就会继续成倍提高,直到某次袭击出现失败。玩家释放至少双倍(2x)破坏性的几率是多少?玩家形成4倍(4x)或更高破坏性的几率是多少?

问题3. 你决定在最新杰作RTS-FPS-电子宠物-运动混合游戏中植入赌博迷你游戏。此赌博迷你游戏非常简单:玩家下注红宝石,赌硬币会出现正面,还是反面。玩家可以在胜出的赌局获得同额赌注。你会将硬币投掷设计成公平程式,但你会向玩家提供额外功能:在屏幕右侧显示最近20次的硬币投掷结果。你是否会请求程序员引入额外逻辑运算,防止玩家利用此20次投掷结果列表,以此摧毁你的整个游戏经济体系?

我们将在文章末尾附上这些问题的答案。

游戏设计师——复兴人士&非专家

Designerus Gamus from gamasutra.com

Designerus Gamus from gamasutra.com

如今设计师这一职业要求各种各样的技能。设计师是开发团队的多面手,需要消除美工和编程人员之间的隔阂,有效同团队成员沟通——或者至少要学会不懂装懂。优秀设计师需要对众多知识有基本的了解,因为游戏设计是各学科的随机组合。

我们很常听到设计师争论线性或非线性故事叙述、人类心理学、控制人体工学或植入非交互事件序列中的细节内容;你很少看到他们深究微积分、物理学或统计学之类晦涩科学的梗概内容。当然依然存在Will Wrights这样的人士,全心致力于天体粘性物及动态城市交通规划。但多数人都会在遇到方程式时选择退缩。

概率学+统计学=杰出成果

概率学(P)和统计学(S)是两门对游戏设计师来说非常重要的复杂科学——或者至少对他们来说应该非常重要。它们之间的关系就像豌豆和胡萝卜,但和那些美味的蔬菜一样,它们不是同个事物。简略来说就是:

概率学:预测事件发生的可能性

统计学:基于已发生事件下结论

综合起来,P和S让你可以做到这些:同时预测未来和分析过去。这多么强大!但记住:“力量越强大,责任越重大。”

P和S只是设计师工具箱中的工具。你可以且应该在设计游戏时充分利用它们,这样游戏才会更具平衡性和趣味性。

好事坏事接二连三

P和S有许多厚厚的教材,本文并非这类教材的替代内容。

这一系列的文章旨在让你把握P和S的若干主要话题,主要围绕设计师需投以关注的要点。

这一部分主要谈论针对游戏设计师的概率学。

记住,成为多面手设计师并不意味着你需要变成这些领域的专家;你只要能够唬弄其他人即可。

建议:强化对“理论”、“编撰”和“分类法”的运用能够促使合伙伙伴朝这些目标迈进。开发者不妨对各学科进行高谈论阔。

The Ivory Tower in Which Designers Live from gamasutra.com

The Ivory Tower in Which Designers Live from gamasutra.com

现在我们开始切入正题。

概率学

多数游戏都会在基础机制中融入1-2个概率学元素。就连国际象棋也需要靠掷硬币来决定谁执白棋。通常,我们将概率学机制称作“随机事件”。随机一词的意思也许是“完全随机”,也许是“刻意随机”。无论是《德州扑克》、《魔兽世界》,还是《炸弹人》,随机事件都有融入它们的核心游戏机制中。

概率学:这不仅是个不错构思,还是个设计法则!

你多半听过“根据概率学法则”这样的表述。这个短语的关键词是“法则”。概率学围绕的是无可争辩的事实,而不是猜测。从学术角度来说,这就主要是概率论,但出于游戏设计目的,你完全能够计算概率。当你投掷6面骰时,摇到“6”的几率是1/6=16.7%—–假设这是次公正的“投掷”,骰子制作合格。16.7%不是猜测数值。这几乎等同于事实(也许有人会从量子力学角度出发,认为16.7%不属于事实。我的意思是,骰子可能会突然变形,进而不复存在,或者你查看骰子的不当方式曲解它原本的波动函数)。大家在概率学方面的多数错误理念都和认为概率学不是基于法则,而是基于近似值或指导方针的观念有关。不要陷入这些误区。下面我将谈到几个常见误区,大家务必多加注意。

独立和相关事件

我将先从一个重要特性切入,谈论概率学的热门话题:事件属于独立,还是相关。这你是计算概念前必须要把握的要点。

独立事件:事件的出现概率和另一事件发生与否无关。例如,投掷6面骰(事件1),然后再次进行摇掷(事件2),都是属于独立事件。第一次摇掷和第二次摇掷没有任何关系。你在事件1的摇掷结果对事件2没有任何影响。另一独立事件的例子是,从一个牌组中抽出一张纸牌,然后再从另一个不同牌组中抽出一张纸牌。

相关事件:一个事件的出现几率和另一事件存在相关性。例如,从牌组中抽出一张牌(事件1),然后再从同个牌组中抽出一张牌(事件2)。第二次抽到王的几率会受到事件1的影响(游戏邦注:若你在事件1中抽到王,那么在事件2中抽到王的几率就会受到影响,因为牌组中的王变少了)。

条件概率

概率学的一大益处是,能够计算条件事件的概率——也就取决于其他事件发生概率的事件。例如,我过去一直玩传统《战锤》桌面游戏,游戏主要基于6面骰。根据“撞击”图表,若不熟练的战士(配备低级的武器技能)和高级敌人配成一组,那么你就需要连续摇到两次“6”,方能进行袭击。那么连续两次摇到“6”的概率是多少?

先说重点,你需要先摇到第一个“6”(1/6的几率),然后你得摇到另一个“6”(1/6的几率)。若一个事件的发生取决于另一事件的成败,那么你需要将二者的概率相乘,方能得到最终发生概率。在此,就是1/6 x 1/6 = 1/36,这就是你连续两次摇到“6”的概率。

通过这一新发现的条件概率,我们很容易进行疯狂骰子投掷的几率运算。你连续摇到4个“6”的几率是多少?答案是1/6 x 1/6 x 1/6 x 1/6。或者更简单的,(1/6)4 = .0008 = .08%。那么连续摇到10个“2”呢?(1/6)10 =相当小的百分比。

Incontrovertible Visual Proof that Four “6”s is Possible from gamasutra.com

Incontrovertible Visual Proof that Four “6”s is Possible from gamasutra.com

逐步提高难度,在摇到“5”或“5”以上数字后,摇到“3”或“3”以上数字的几率是多少?就是4/6 x 2/6 = 8/36 = 2/9 = 22.2%。

迷信和均分谬论——“赌徒谬论”

大家在概率学方面的一个常见错误观念是,模糊独立事件和相关事件之间的界限。这主要体现在如下模式:

BAD THINKING AHEAD! from gamasutra.com

BAD THINKING AHEAD! from gamasutra.com

错误1:认为若上次摇到的是“5”,那么“5”出现的几率就变小。

错误2:认为若连续10次都没摇到“6”,那么“6”出现的几率就很高。这相当于认为,若“红色”多次没有在轮盘上出现,那么它很快就会出现。

错误3:在投掷10次硬币,8次出现正面,2次出现反面后认为,在接下来的10次投掷中,反面出现的几率会更高,以实现“平均化”。

所有这些都属于“赌徒谬论”。从根本来说,这其实就是混淆独立事件和关联事件的概念。这一谬论的另一表现是,“我刚在赌轮盘中输掉所有资金,因为概率法则违抗均分谬论”。这和鲜为人知的“赌场为什么允许我记录轮盘旋转结果?——显然他们知道我将发现其中模式,打破轮盘谬论?”这一观念存在密切关系。

不要陷入这些误区。摇掷骰子多次或旋转轮盘都是属于独立事件,纯粹而简单。下面就来深入查看上述错误:

错误1:通过6面骰摇到“5”的概率是1/6 = 16.7%。这从来没有变过。这和你是否连续摇到8次“5”或很久都没摇到“5”毫无关系。16.7%依然是个幻数。“骰子没有记忆”是个惯用语,这完全正确。

错误2:和上述内容相同。摇到“6”或转到“红色”的几率和此前的摇掷或旋转情况毫无关系。轮盘也没有任何记忆。

平均数定律遭到否决

错误3也是个类似,但有所拓展的错误观念:认为所有事件在长期范围内都会“均衡化”——平均数法则。的确投掷硬币1000次,你有望看到50%的正面,50%的反面。但这里没有所谓的“校正”。若你投掷硬币10次,有8次正面,2次反面,那么接下来的10次投掷没有理由会出现更多反面。你也许会犯下哲学错误,认为“该出现正面”,甚至犯下更大错误,在此投入众多资金。

这里的要领是,若你投掷硬币100万次,你看到正面和反面的几率都是50%。但不要认为正面出现的次数会和反面保持平均——其实它们可能会相差几百次,或者甚至几千次。记住,当正面出现次数比反面少1万次时,二者的出现概率依然接近于50%/50%(游戏邦注:准确来说,是49%/51%)。所以不要在此下赌注,认为8:2的正反出现概率会在随后的投掷过程中得到“校正”。虽然从长远来看,正反面的出现概率接近于50%/50%,但正反面各自的出现次数差距会随投掷次数的增加而增加。

反向概率

我们很容易找到计算独立或关联事件出现概率的公式。但有时要计算更多相关概率就没那么容易。一个需要你把握的重要概念是“反向概率”。计算反向概率,你需要判断的是某事件没有发生的概率,而不是它发生的概率。然后将1.0 (100%)扣除此数,这样你就会得到你所要的概率数值。

反向概率101:简单例子

假设你即将投掷一个6面骰。你投到“6”的概率有多大?虽然我们已经知道答案,这里我们将运用反向概率进行论证。你没有摇到“6”的概率是5/6 ,因此你摇到“6”的概率是1–5/6 = 1/6,或是16.7%。换而言之,你没有摇到“6”的概率是5/6,那么你摇到“6” 的概率是1/6。这毫无疑义。

反向概率201:凑成同花顺

在某情况下,反向概率能够帮你节省资金。那就是《德州扑克》,假设你在拼凑红桃同花顺,手中已有2张红桃(公共牌有2张),然后还有2次抽牌机会。换而言之,若你下次抽到红桃,那么你的牌组就是同花顺。这出现的概率有多大?

flush from gamasutra.com

flush from gamasutra.com

我们很容易就能算出红桃在下张牌中出现红桃的概率。“牌组”中还有9张红桃没被抽取(13-4=9,手中2张+公共牌2张)。牌组还剩47张牌(52-5=47,手中3张,公共牌3张)。因此,下次抽到红桃的概率是9/47。若抽到的不是红桃,那么随后抽到的概率就是9/46(红桃数量依然没变,但总牌数减少)。

唯一问题是,我们如何算出在两次抽牌中抽到红桃的总概率?我们很容易就会犯下这一错误,认为是9/47 + 9/46。但这并不正确。这和下述错误类似:认为6次摇到“6”的总概率是1/6 + 1/6 + 1/6 + 1/6 + 1/6 + 1/6 = 1.0 = 100%。遗憾的是,我们无法在摇掷6次骰子后100%摇到“6”。

事实证明,通过反向概率解决这两个问题要简单得多。我们会这样设问:“没有抽到红桃的概率是多少?”就第一次而言,概率是(47 – 9)/47 = 38/47。第二次的概率是(46 – 9)/46 = 37/46。根据条件事件方面的知识,我们很容易就能够算出这两个事件的发生概率。换而言之,我们需要算出两次都没抽到红桃的概率,即38/47 x 37/46 = 65.0%。我们对凑成同花顺的概率非常感兴趣,所以我们将1.0扣去此数值,得到1.0 –0 .65 = 0.35 = 35%。所以凑成同花顺的概率是35%。

注意:摇骰子问题的计算方式也类似。6次中至少摇到1次“6” 的概率是通过计算没有摇到“6” 的概率得来。在每次摇掷中,没有摇到“6”的概率是5/6。因此,6次完全没有摇到“6”的概率就是:5/6 x 5/6 x 5/6 x 5/6 x 5/6 x 5/6 = 0.33 = 33%。所以,至少摇到1次“6”的概率是1.0 –0 .33 =0 .67 = 67%。因此你将有2/3的几率摇到至少一次“6” 。

关于反向概率,我们需记住的是,有时算出事件未发生的概率要比计算它们发生的概率简单得多。

关于随机数据生成器

关于概率,数字游戏设计师须知的一点是:随机数据生成器并不随机。随机数据算法需要“始值”,这是算式获得自身原始数据,进行能够带来所谓随机数据的循环运算的的基础。很多时候,程序会取样CPU钟点,或类似于始值的数据(游戏邦注:这能够促使算法保持随机性)。但对于包含众多随机数据生成内容的高强度游戏而言,有时这依然不够随机。让我们以在线扑克供应商为例。玩家需要知道控制牌组重洗的随机数据没有潜在模式。在诸如这类的极端情况下:资金取决于收入,程序员需要进行精心设计,逐步以CPU热量和函数作为始值,而不是钟点。

这里的建议是,数字游戏没有真正的随机数据。很多时候,这没有问题,但若你的游戏融入众多数据信息,就要留心其中模式。

回到问答题目

下面回到文章开始的问题。

问题1. Orc Nostril Hair的出现概率

在此情况中,两位测试者的结果都处于概率范围内。若每次消灭怪兽,发现Orc Nostril Hair(ONH)的基本概率是10% ,那么消灭20只怪兽后发现至少4次ONH的概率是13.3%。你也许会问,我如何得到这一数据?在此,我运用了一个高级概念,叫做二项分配,但这并不是本文的谈论内容。

在20次机会中发现0次ONH的几率是由反向概率决定:

在每次消灭怪兽后有10%的几率发现道具意味着同时会有90%的概率没有发现道具。

在20次机会中没有发现道具的概率是(.90)^20 = 12.2%。

所以在20次机会中发现4次ONH的概率和发现0次ONH的相同。

要判定自己是否真的需要担心编程漏洞,你需要更多信息。你需要测试者提供更多数据点,这样你才能够做出令人信服的结论。

例如收集100个体验回合的信息(游戏邦注:每个回合包含100种技能)。这是一组庞大数据。若在这些体验回合中,玩家发现ONH的概率多于或少于10%,那么你的回馈率可能存在漏洞。在这种情况下,你就应该加以关注。

问题2. 2x-3x-4x+重击

形成至少2x破坏性也就是连续击中两次的条件概率:

2x或更高破坏性的概率=0.75 x 0.75 = 56.3%

4x或更高破坏性的概率=(0.75)^4 = 31.6%

哇,玩家形成4x或更高破坏性的几率是1/3。你需要修改游戏机制。或降低基础击中率,或提高连续重击难度。

money from gamasutra.com

money from gamasutra.com

问题3. 投掷硬币

这个问题是个设计粗糙的陷阱。首先,你通过向玩家呈现前20次投掷情况给予他们一定援助,然后你需要稳固自己的机制,防止玩家滥用。

答案就是,告知玩家前20次投掷情况丝毫不影响硬币投掷结果的50/50比例。这让玩家陷入赌徒谬论中。

我甚至建议当玩家在连续出现两次“反面”后下注“正面”时,若他们胜出,支付他们少于同额赌注的资金。告诉他们,你们处于不公平的有利地位,知道“正面”定会出现。他们会信以为真。

die from gamasutra.com

die from gamasutra.com

游戏邦注:原文发布于2006年10月18日,文章叙述以当时为背景。(本文为游戏邦/gamerboom.com编译,拒绝任何不保留版权的转载,如需转载请联系:游戏邦

Statistically Speaking, It’s Probably a Good Game, Part 1: Probability for Game Designers

by Tyler Sigman

Quiz Time — Whoopee!

Q1) You are designing a new MMORPG, and you set a particular item — Orc Nostril Hair – to drop 10% of the time when a certain species of monster is killed. One of your testers reports back that he killed 20 of the monsters, and found the Orc Nostril Hair 4 times. Another tester killed 20 of the monsters and never found a single Orc Nostril Hair. Is there a programming bug?

Q2) You are designing a combat system for a game and have decided to include a critical hit mechanic. If the character lands a successful hit (say 75% base chance to hit), then you roll another hit check. If the second hit check is successful, the player will do double damage (2x). However, if this happens, you roll another hit check, and if that’s successful, then the damage is upgraded to triple damage (3x). As long as each hit check is successful, you keep making new checks, and the damage multiplier keeps increasing until a hit check is missed. What percentage of the time will the player get at least double damage (2x)? What percentage of the time will the player get quadruple damage (4x) or better?

Q3) You have decided to include a gambling mini-game in your latest magnum opus RTS-FPS-tamagotchi-sports hybrid game. The gambling mini-game will be very simple: the player can wager rubies on whether a coin flip will come up heads or tails. The player always receives even money on his winning bets. You will make the coin flip as fairly programmed as possible (50%/50%), but you will include an extra feature for the player: a list of the last 20 coin flip results will be shown on the right side of the screen. Should you beg the programmers to include any extra logic to prevent the player from taking advantage of this 20-flip history and using it to bankrupt your entire in-game economy?

We’ll attack the answers to these captivating questions at the end of this piece (if you’re still awake).

Game Designers – Renaissance People and Anti-Experts

Being a designer in this day and age requires a pretty wide variety of skills. Designers are the generalists of the development team, needing to bridge the gap between Art and Engineering, competently communicating with each — or at least competently faking it. A good designer requires a basic understanding of a lot of different things, because game design is a haphazard amalgamation of subjects.

It’s pretty common to hear designers debating or waxing poetic on the finer points of linear or non-linear storytelling, human psychology, control ergonomics, or the integration of non-interactive sequences; less often do you catch them mulling over the bare bones details of the hard sciences like calculus, physics, or statistics. Sure, there are the Will Wrights, determined to find fun in celestial goo and the dynamics of city traffic planning. Most, though, wince when equations start breathing down their necks.

Probability + Statistics = Cool

Probability (P) and Statistics (S) are two hard sciences that are hugely important to game designers—or at least should be! They go together like peas and carrots, but like those yummy veggies, they aren’t the same thing. Coarsely put:

Probability: predicts the chance that an event will happen

Statistics: draws conclusions based upon events that have already happened

Taken together, P and S allow you to perform amazing parlor tricks: you can both predict the future and analyze the past! What power! Remember, though: “With great power comes great responsibility.”

P and S are simply tools in your Designer’s Toolbox (you know—the one under your desk). You can and should use them to your advantage to design games that are better balanced and ultimately more fun!

Good and Bad Things Come in Threes

There are lots of scary, thick textbooks out there about P and S, and this discussion isn’t meant to be a substitute for you going out, doing your due diligence and reading them. (Note: falling asleep with them on your chest *does not* count as learning.)

What this series of 3 articles *will* do is give you a basic understanding of some key topics from both P and S. Specifically, we’ll focus on things that designers should give a rat’s behind about.

1. Part 1 (You’re reading it, buster): Probability for Game Designers

2. Part 2: Statistics for Game Designers

3. Part 3: Shaping Game Mechanics with Probability and Statistics

Remember, being a well-rounded designer doesn’t mean you have to be an expert in these things; you just have to be able to fool anyone else who isn’t!

TIP: Increasing your usage of “theoretically”, “codify”, and “taxonomy” will most certainly impress your coworkers towards these ends. Other disciplines love it when designers use big words! You can thank me for this wisdom later.

Ok, enough beating around the bush — on to the good stuff!

P R O B A B I L I T Y

Most games have one or more elements of probability incorporated into their base mechanics. Even chess requires the flipping of a coin to determine who takes white. Usually, we call probabilistic mechanics “random events”. Of course, the term random really might mean “completely random” or “sculpted random.” Regardless, whether you’re talking Texas Hold’em, World of WarcraftTM, or BombermanTM, random events are integrated into key game mechanics.

Probability: It’s not Just a Good Idea…It’s the Law!

You’ve probably heard the term “according to the laws of probability.” The key word in the phrase is “laws.” Probability is all about indisputable facts, not guesses. Ok, technically it’s all Probability Theory, but for the purposes of game design you can compute probabilities absolutely. When you roll a six-sided die, the chance of rolling a “6” is 1/6 = 16.7%—assuming a fair ‘throw’ and a perfectly manufactured die, of course. This 16.7% is not a guess, nor anything of the like. It is as good as fact*. Many of the most common thought errors that people make concerning probability have to do with the belief that probability is not based on laws, but rather on approximations or guidelines. Don’t fall into the traps! I’ll mention a few of the most common ones below, and try to draw some big DANGER! signs around them.

*I guess there might be quantum mechanical concerns that make the 16.7% not exactly fact. I mean, the die could suddenly warp out of existence or maybe your act of looking at it unfairly forces it to collapse its wave function (a severe inconvenience, to be sure).

Independent and Related Events

Let’s start our whirlwind tour of Probability’s Greatest Hits with a key distinction: whether events are independent or related. It’s vital to know before you can start calculating probabilities.

Independent Events: The chance of each event occurring does not depend in any way on what happened in the other event. For example, rolling a six-sided die (event #1) and then rolling it again (event #2) are independent events. The first and second rolls are not related in any way. The number you rolled in event #1 has absolutely zero influence on event #2 (see the “Fallacy of Equipartition”, later). Another example of independent events is drawing a card from a poker deck and then drawing a card from a second, totally different deck.

Related Events: the chance of each event happening is related in some way to the other event. For example, drawing a card from a poker deck (event #1) and then drawing a second card from the same deck (event #2). The chance of drawing a Jack on event #2 is affected by event #1—if you drew a Jack on event #1, then there’s a smaller chance of getting one in event #2 because there are less Jacks remaining in the deck.

Conditional Probability

One of the most useful bits of probability to know is how to calculate the chances of conditional events—that is, events that rely on other events occurring. For example, I used to play lots of old WarhammerTM tabletop games which are d6 based. According to the “to Hit” charts, if you had a somewhat unskilled warrior (with a low Weapon Skill) matched up with a superior enemy, you might have to roll a “6” followed by a “6” in order to hit. Just what is the chance of rolling a “6” followed by another “6”?

Well, first things first, you have to get the first “6” out of the way (a 1/6 chance). Then, you need to roll another “6” (a 1/6 chance again). Whenever one event depends on another’s success, you multiply the chances to get the cumulative chance of both occurring. In this case, it’s a 1/6 x 1/6 = 1/36 chance to roll a “6” followed by a “6”. (Note: If you have an irrational fear of rational numbers—har har—then you can always convert the fractions to decimals by using your calculator. In this case, 1/36 = .028 = 2.8%)

Armed with this newfound power of Conditional Probability, it’s very easy to calculate the chances of crazy dice throws. What are the chances that you can roll four “6”s in a row? The answer is 1/6 x 1/6 x 1/6 x 1/6. Or more simply, (1/6)4 = .0008 = .08%. How about ten “2”s in a row? (1/6)10 = AnIncrediblySmall%.

Ratcheting up the difficulty, how about the chances of rolling a “3” or above followed by a “5” or above? It’s just 4/6 x 2/6 = 8/36 = 2/9 = 22.2%. Now we’re rockin’ the free world!

Superstition and the Fallacy of Equipartition — aka “The Gambler’s Fallacy”

One of the most common and widespread thought errors that people make concerning probability is blurring the line between independent and related events. This typically takes one of the following forms:

Mistake 1: Believing that a “5” is less likely than normal to appear again because the last dice roll was a “5”.

Mistake 2: Believing that a “6” has a very high chance of being thrown because 10 rolls have gone by without a “6” being thrown. Dressed in another outfit, this is believing that “red” is due on a roulette wheel because it has been several spins since the last “red” hit.

Mistake 3: After flipping a coin 10 times and getting 8 heads and 2 tails, believing that the next 10 flips will have more tails then heads in order to “even out.”

These all loosely fall under the appropriately well-named “Gambler’s Fallacy.” Basically, this is just the name for confusing independent and related events. Another name for this fallacy is “I just lost all my money at roulette because the Laws of Probability defied me Fallacy.” It is closely related to the lesser-known “Why do casinos allow me to keep a written log of the recent roulette spins — surely they know that I’ll be able to figure out the pattern and beat the wheel Fallacy?” (Note: that last fallacy typically is followed quickly by the previous one.)

Don’t fall into these traps! Rolling a die multiple times or spinning a roulette wheel are independent events, pure and simple. Let’s examine each of the above mistakes more closely:

Mistake 1: The chance of rolling a “5” on a d6 is 1/6 = 16.7% This never changes. It doesn’t matter if you’ve thrown eight “5”s in a row or haven’t seen a “5” since Gilligan’s Island premiered. 16.7% is still the magic number. “Dice don’t have memory” is a common phrase overheard…and it’s correct!

Mistake 2: Same as above. The chance of rolling a “6” or hitting “red” has absolutely nothing to do with the rolls or spins that came before. Roulette wheels don’t have memories either (unless they are actually magnetized and “Vinnie the Spinnie” is making sure that your number never comes up).

The most common argument that people make for mistakes 1 and 2 goes something along these lines:

The Law of Averages Got Vetoed

Mistake #3 (from back before Scene 24b) is a similar, but extended error: believing that over the long run, everything will “even out” — the Law of Averages. It’s true that, out of 1000 flips of a coin, you’d expect to see roughly 50% heads and 50% tails. But there is no such thing as a “correction.” If you flip a coin ten times and get 8 heads against 2 tails, there is no global essence or power that is going to squeeze a few more tails into the next 10 flips. You would be making a grave philosophical error to assume that “tails are due”, and an even graver error to put big money on it. Peter Webb has an excellent short discussion on this subject at his website (see recommended reading at the end of this article).

The gist is, if you flip a coin 1 million times, you’ll expect the heads and tails split to be close to 50%. But don’t expect the NUMBER of heads flips to equal the NUMBER of tails flips — in fact, it’s very likely that they will be off by hundreds or even thousands. Remember, you could have 10,000 less heads than tails and the division would still be very close to 50%/50% (49%/51%, to be exact). So don’t put money on assuming that an 8-to-2 heads lead (+6 heads) will be corrected as you flip more coins! It’s very likely that even if the heads/tails split will be close to 50%/50% in the long run, the actual difference between number of heads and number of tails will probably grow as the total number of flipped coins grows.

Converse Probability

It’s easy to find formulas that will help you calculate the chances of independent or related events. Sometimes, though, it can be very, very difficult to calculate more involved probabilities. One trick that you can pull out of your hat to save the day is the concept of “converse probability.” To calculate converse probability, instead of trying to determine the chances that something will happen, you instead calculate the chances that something won’t. Then, you subtract this number from 1.0 (100%) to get the probability that you are looking for.

Converse Prob 101: Easy Example

You are about to roll a six-sided die. What are the chances that you’ll roll a “6”? Although we already know the answer, we’ll use converse probability to verify it. The chances you won’t roll a “6” are 5/6 (5 out of 6 of the die sides are not a 6). Therefore, the chance of rolling a “6” is 1 – 5/6 = 1/6, or the familiar 16.7%. In other words, if you won’t roll a “6” 5 out of 6 times, then you will roll a “6” 1 out of 6 times. That almost makes sense!

Converse Prob 201: Flush with Excitement

Here’s a situation where converse probability really is a money saver. It’s Texas Hold’em, and you are four cards to a heart flush with two cards to come. In other words, if a heart comes on the Turn or the River, you’ll complete your flush**. What are the chances this will happen?

**Given the choice between the two, I recommend completing your flushes on the River — this has the greatest chance of psychologically destroying your opponents and sending them into apoplectic fits. Nobody likes getting Rivered.

It’s very easy to calculate the chances of a heart coming on the next card. There are 9 hearts remaining “in the deck” that have not been flipped up yet (13 to begin with minus the 4 already showing between the flop and your hand). There are 47 cards total in the deck (52 minus the two in your hand and the three flopped on the board). Therefore, the chances of flipping a heart on the next card are 9 out of 47, or 9/47. If that card isn’t a heart, then the chance of flipping a heart on the following card is 9/46 (there are still 9 hearts remaining, but one less card total in the deck).

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.

Quiz Show Redux

If you’ve read this far, then we’re both exhausted. Hopefully, though, we have also developed a nice golden-brown brain tan. So let’s revisit the questions from the beginning of this article.

Q1) Orc Nostril Hair Drop Rates

It’s too early to panic. Never panic unless you are sure you should panic. If you are sure you should panic, then panic, and panic well.

In this case, both testers’ results are certainly within the realm of probability. If there is a base 10% chance of finding the Orc Nostril Hair (ONH) on each monster-slaying, then the chances of finding at least 4 ONH in 20 tries is 13.3% Where did I get that number, you might ask? Well, I cheated and used an advanced concept called Binomial Distribution, but sadly (or happily?) it is beyond the scope of this article.

The chance of finding zero ONH at all through 20 tries is determined through converse probability:

10% chance of finding item on each kill means 90% chance of not finding it (0.90).

Chance of not finding it through 20 kills = (.90)^20 = 12.2%

So there is about the same chance of finding 4 ONH in 20 tries (13.3%) as there is finding zero ONH in 20 tries (12.2%). Not yet cause for justified panic.

To really determine if you should panic, you need more info. You need lots of data points from your testers in order to draw an informed, statistically-based conclusion (OK, I’m jumping ahead to part 2. Indulge me.)

Let’s say you collect info on 100 play sessions, each of which involve 100 kills. That’s a respectable amount of data. If out of those sessions, players are finding ONH a lot less or a lot more than 10% of the time, then you probably have a bug that is affecting your reward rates. In that case, panic with all haste! Tip: Sprinting around the office screaming “No!” generally gets quick results.

Q2) 2x-3x-4x+ Critical Hits

The chances of doing at least 2x damage are found by the conditional probability of hitting twice in a row:

Chance of 2x or better = 0.75 x 0.75 = 56.3%

Chance of 4x or better = (0.75)^4 = 31.6%

Wow. Players will do 4x or better damage almost 1/3 of the time. Fix your system, dude/dudette! Either drop the base hit percentage or make the successive critical levels harder to achieve.

Q3) Will Flip Coins for Money

This question is a silly trap, not-so-elaborately laid. First you give the player help by showing them the last 20 flips, then you need to shore-up your system to present exploits. Sheesh!

The answer, of course, is that providing the player with this 20-flip history changes nothing about the fact that each coin flip is a 50/50 proposition****. Let the player wreck himself with the Gambler’s Fallacy.

Heck, I even recommend paying out less than even money every time a player bets “heads” after 2 successive “tails” results. Just tell ‘em you are adjusting to their unfair advantage of knowing “heads” is due. They’ll believe you, they will…

****Natch, discounting any flaws in your random number generator that simulates the coin flip.

What are the Chances that this Article was Interesting?

I may be a gambling man, but I won’t dare to give odds on that.

If you survived the last few thousand words or even enjoyed them, stay tuned. In Part 2, we’ll explore the “Two-Drink Minimum” science of Statistics. And finally, in Part 3 (the riveting conclusion), we’ll look at the anatomy of a number system and explore how your choices as a game designer can sculpt a game’s mechanics into a true work of art. No, really!(Source:gamasutra


上一篇:

下一篇: