D&D-ish Probability/Algorithm Problem

Mar 10, 2008 12:52

Suppose you're playing D&D and have a house-rule spell that does 100 attacks, each performing 1 point of damage to a random live enemy. (Suggested name: Schmendrick's Death From Papercuts.) So, if you are facing exactly one opponent it performs 100 hit points of damage to him; if you are facing 100 enemies each will get, on average, one point of ( Read more... )

algorithm, theory, games, programming, random

Leave a comment

greykev March 11 2008, 00:50:40 UTC
in a truly average/random system I'm not sure it matters when the individual points fall on an opponent, if they stop receiving them at point of death. either more go to the high HP creatures early, or more will go once the lessers fall, in the end you're allocating damage by hit point totals, if I understand your scenario correctly.

so, um? for fewer than 100 opponents, take lowest hit point value and multiply by number of enemies. if result is <100 apply damage evenly, eliminate lowest HP opponent(s) repeat using adjusted HP totals until all 100 points have been doled out. if result on subsequent checks is greater than remaining damage divide remaining damage points evenly to remaining opponents, with highest HP total receiving any excess damage.

Melf the wizard faces 3 kobolds (HP 7) 2 bug bears (HP 23) and a firbolg (HP 45) He casts the spell: the lowest HP(7) x 6 opponents = 42 damage divided equally, 58 points of damage remaining. Kobolds are eliminated, bug bears (HP 23-7=16) firbolg (HP 45-7=38) 16 X 3 = 48 <58 16 points divided to each opponent, bugbears eliminated. firbolg (HP 38-16=22) receives remaining 10 points of damage.

Or you could total the hit points of the opponents, subtract 100, and allocate the remainder evenly to the limits of the creatures. That would unfairly damage the "big" opponents in favor of the little ones though. in the above example 112-100=12HPs remaining, or 2 HP per opponent. I favor the first solution.

Reply

greykev March 11 2008, 00:53:24 UTC
all of which assumes we know the HP totals of the opponents. If that's unknown, or the process cannot tell when an opponent is dead, I'm at a loss.

Reply

markgritter March 11 2008, 02:39:24 UTC
That's not really what I asked for--- in the original description of the spell there is some probability that one or more of the kobolds survive. If you imaging rolling a D6 for each 1-point attack it is possible that we roll fewer than a total of 21 1's, 2's, or 3's. (Not likely, but possible.)

If we modify your example a bit it is easy to calculate it exactly. If we have 1 kobold with 7 hit points and 5 epic kobolds with 100 hit points then the spell will never kill an epic kobold (except maybe on the very last attack, which we can ignore.) In this case we just have a binomial distribution: how likely is it that we will roll a 1 fewer than 7 times? That works out to about 0.13%.

Unfortunately I don't see a simple way of handling death, which breaks the binomial distribution. If one 7-point kobold dies the others are more likely to get hit.

Reply


Leave a comment

Up