# Probability of defeating enemy (info on distributions added)

I have 27 hit points and my opponent has 50, and the winner is the player that reduces the other player's hit points to 0 first.

My expected damage inflicted per round is 5. My expected damage taken per round is 7/3.

I have the first attack.

What are my chances of winning?

edit: As pointed out, the question is unanswerable without further info on distributions, so here it is:

A round consists of multiple attacks. If I hit, I can attack again. My damage per hit is 5/6 1, and I have a 5/6 probability of hitting. I figured this makes a geometric series with $a = 5/6, r = 5/6$, so using $a / (1 - r)$ we get an expected damage of 5. Edit: Typo above. Damage is 1 point if I hit, so expected damage is 5/6. (Geometric series is still correct.)

When defending, similar rules apply. My damage taken is 7/6, and probability of being hit is 1/2. So a geometric series gives expected damage taken as 7/3. Edit to clarify: Actually I have a 1/6 chance of taking 3 damage, and 2/6 chance of taking 2 damage, which aggregates to 7/6.

So as a supplementary question, clearly this is a discrete distribution, but can we approximate to something linear and solve analytically? Or am I best off just doing a million trials by computer?

-
Is this turn-based? –  Unreasonable Sin Nov 4 '11 at 16:47
@UnreasonableSin yes it is. –  Altheus the Unready Nov 4 '11 at 16:49
This question is not answerable without knowing the distribution of damage inflicted per round. Consider two cases: (1) you have a 99% chance of inflicting zero damage and a 1% chance of inflicting 500 damage, (2) you have a 100% chance of inflicting 5 damage. In both cases your opponent has a 100% chance of inflicting 7/3 damage. Then in case (1) the chance of you losing is 88.6% (i.e. the chance that you do zero damage for the first 12 rounds) but in case (2) you are guaranteed to win. –  Chris Taylor Nov 4 '11 at 16:54
These are good points. I will add some info on distributions... –  Altheus the Unready Nov 4 '11 at 16:58
Do you keep swinging until you miss? If so, your expected damage is indeed $5$ and the opponent's is indeed $7/3$. If you just get one swing the expected damage you do is $25/36$ and your opponent's is $7/12$ –  Ross Millikan Nov 4 '11 at 17:53

If you're reduced to brute-forcing it by computer, you don't need a million trials. Just fill in a $50\times 27\times 2$ array with the probabilities of winning, given the point standings and who's currently attacking. Compute the lowest points first and work your way up to the $(50,27)$ point.

-
I like it. Thanks for the tip. –  Altheus the Unready Nov 4 '11 at 17:48
It is slightly more complicated because of fractional damage. –  Henry Nov 4 '11 at 20:19
There is no fractional damage... sorry, I have amended the question. I have a feeling the distribution is too complex to do anything useful with pen and paper, but we can still get an exact answer using the approach in this answer, so unless anyone comes up with a better solution I will accept this answer. –  Altheus the Unready Nov 4 '11 at 21:12

You don't have enough information to answer. A simple way to see that is to assume your opponent will always do 7/3 damage, so you will always get 12 hits. If you always do 5 damage you will win every time. If you do 5000 damage one time in 1000, you will win about 12/1000 (slightly less).

-

It depends on the actual damage distributions. For example, if you always take 7/3 and deal 5, your odds of winning are 100%. If you always deal 5, take 7 with 1/3 probability and 0 with 2/3 probability, your odds of winning are 12800/19683 or 65%.

-

Let's try something practical, building on Henning Makholm's answer.

First, let's get rid of fractional hit points, by dividing hit points by the effect of hits: you lose if you take 24 hits and you win if you inflict 60 hits.

Now if you have taken $a$ hits and your opponent has taken $b$ hits, let $f(a,b)$ be the probability of you winning if you have the next attempt and $g(a,b)$ be the probability of you winning if your opponent has the next attempt. $f(24,b)=g(24,b)=0$ if $b<60$ and $f(a,60)=g(a,60)=1$ if $a<24$. Then $$f(a,b)=\tfrac{5}{6}f(a,b+1)+\tfrac{1}{6}g(a,b)$$ $$g(a,b)=\tfrac{1}{2}f(a,b)+\tfrac{1}{2}g(a+1,b)$$ but this is slightly circular so turn them into $$f(a,b)=\tfrac{10}{11}f(a,b+1)+\tfrac{1}{11}g(a+1,b)$$ $$g(a,b)=\tfrac{5}{11}f(a,b+1)+\tfrac{6}{11}g(a+1,b)$$

and calculate. I think $f(0,0)$ may be about $0.95168$.

-
Hi Henry, apologies, there are no fractional hit points - it's actually a 1/6 chance of taking 3 points and 2/6 chance of taking 2 points damage. I did a computer simulation of a million trials and got 64.3% win rate. –  Altheus the Unready Nov 4 '11 at 20:55