cellio: (avatar)
Monica ([personal profile] cellio) wrote2004-11-23 11:53 pm
Entry tags:

D&D and probability

Tonight's D&D game (fun game, but more about that later) involved a big fight (a duel of sorts), which we'd been able to plan for in advance. The result of this has been a lot of email over the last week or so, which has been interesting. And because some of us are geeks, part of that volume of email has been dedicated to a discussion of probability theory.

The opponents had proposed entering the arena with no preparatory spells cast and then rolling dice each round to see when to start the attack. (Until then we'd be able to take defensive measures.) This led to a discussion of how many rounds of prep to expect for any given die-rolling proposal. (That's "expect" as in "expected value", not "expect" as in "really think this will happen every time", of course.)

This is a simple probability problem, if you're up on your probability theory. The three people who explicitly tried to answer the question used three different approaches.

I, being rather distant in time from formal math of any sort, took the intuitive approach: for N equally-probable outcomes, the expected value is N/2. (I'll justify this error in comments if asked. There was actual reasoning behind it, not just a guess.) Ralph wrote a perl script to run simulations, and came up with the same results as Kevin, who applied formal theory. Sure, it's obvious that the answer is log(0.5)/log(1-1/N), right? Um, yeah. Sure. Whatever you say. If he didn't have the perl script backing him up, I'd be more argumentative.

I think this is an illustration of why formal math and I do not get along. I started college life as a math major, but it didn't stick. I'm just fine if I can relate a theory to actual facts I can really observe and understand, but if it's all "sure, whatever you say" to me, then I have trouble conjuring up the correct invocations from memory on demand, and that's what the exams were all about. In a real-world context I do not yet understand why the probability of a 1-in-10 event is 6.6 rather than 5.5. [Edited to add: Sloppy writing -- I meant the expected number of trials before a 1-in-10 event occurs, not the probability.] And if I can't understand it, there's no reasoning involved -- just number-crunching.

This is kind of bizarre when you think about some of the theoretical contexts I'm perfectly comfortable working in. But there you have it: why advanced calculus and everything that followed seemed completely foreign to me.

Oh, as for what actually happened? We wanted to get about 10-11 rounds of prep, so we opted for a match on 2 d20s. The expected value from that would have been 12-13 rounds, which was good enough. It actually went 48. So much for theory. :-)

[identity profile] ralphmelton.livejournal.com 2004-11-24 02:51 pm (UTC)(link)
And we kind of trimmed the tail. I rolled 32 times or so without rolling a match ((19/20)^32) = 19.37% chance of getting that far), and then I said, "okay, no one's casting more spells, so this is boring. I arbitrarily decree that a match is rolled 16 rounds later."

[identity profile] ralphmelton.livejournal.com 2004-11-24 08:33 pm (UTC)(link)
3d4 would be a 1 in 16 chance of a match. So the mean would be 16 and the median would be 10.74.

Variance matters, but this isn't a real distribution; it may be more intuitive to express the variance as a series of goalposts, like this:
With 3d4, the top 75% mark is 4.45 (i.e., there's a 75% chance that the time will be above that)
The 50% mark is 10.74
The top 25% mark is 21.48

With 2d20 (a 1 in 20 chance):
The 75% mark is 5.61
The 50% mark is 13.51
The 25% mark is 27.07

With the 1-in-10 chance we used last time:
The 75% mark is 2.73
The 50% mark is 6.58
The 25% mark is 13.16

(I actually think that there should be an extra +1 for all of these, since there's always at least one roll. But that doesn't change things too much.)