I have calculated the exact probability of killing a lone 4 health minion with avenging wrath, taking into account that the hit chance to the hero becomes 100% when the minion has taken four damage:
I can't see how this can be right - can you explain in words how you came to this conclusion?
(0.5^4)*1 is the chance 4th missile is the one killing the minion. the only way for that to happen is of course getting all 4 first missiles to hit it. chance for that to happen is 0.5*0.5*0.5*0.5*1*1*1*1
(0.5^5)*4 is chance that 5th missile kills the minion. there is four ways it can happen, OXXXXOOO, XOXXXOOO, XXOXXXOOO and XXXOXOOO. Each individual case here have 0.5*0.5*0.5*0.5*0.5*1*1*1 chance for happening, and you have C(4,3)=4 different ways for that to happen.
(0.5^6)*10 is same way 6th missile kills target. C(5,3) ways it can happen, each have 0.5*0.5*0.5*0.5*0.5*0.5*1*1 chance to happen.
Do same for 7th and 8th missile to kill minion you get C(6,3)*0.5^7 and C(7,3)*0.5^8 (C(6,3)=20 and C(7,3)=35, not 19 and 32 like Moonkonnig had)
Then you add all those together. P=( 0.5^8 )*35 + (0.5^7 )*20 + (0.5^6)*10 + (0.5^5)*4 + (0.5^4)*1 = 0.636719
This pretty much clears it up, thank you for the correction, had a little error there :)
There is something strange since I've got a different value of probability with my simulation. My result is around 6.5368% but I've used a less accurate method compared to yours.
I'd like to find a formula as well.
I've run my code and got correct results for situations that are easy to calculate with other methods, so I'm somewhat confident in it. Still, maybe i missed something for 3+ targets. Do you mind sharing your code?
It was a spreadsheet to do a fast check. I've deleted it.
I have a formula for the question about killing 3 and 4 health minions alone on the board with Avenging Wrath.
I've used the trinomial coefficient formula to get the number of favorable cases and the disposition with repetition formula to get the number of possible cases.
M(n,h,k)=n!/h!/k!/(n-h-k)! D'(n,k)=n^k
P(X>=4,Y>=3)=M(8,4,3)/D'(3,8)=280/6561=6.1881%
This value is close to the result of my simulation but really different from yours.
There are 280 favorable cases, but they are not equally likely. Did you account for that?
So i looked closer at it, and 406 are still not all the favorable cases.
M(8, 4, 3) - first minion is hit exactly 4 times, 2nd exactly 3 - all this possibilities are valid. 280 combinations.
M(8, 4, 4) - first minion is hit exactly 4 times, 2nd exactly 4 times - all this possibilities are invalid but add to the probability of killing both minions because the last shot on 2nd minion goes to the face, but both minions are still dead.
M(8, 5, 3) - same as above. That's 406 total combinations.
and now there are possibilities represented by:
M(8, 6, 2) - first minion is hit exactly 6 times, 2nd minion exactly 2 times. This scenario can actually also kill both minions, but not in all cases. Same goes for M(8, 7, 1), M(8, 5, 2) and so on. They sometimes kill both minions. If you add up all this cases i believe you would get my result.
Thats my point. There are invalid cases with 2 dmg on 3hp minion that increase probability of cases that kill both minions. I used my Paint skills to draw the tree :P
As you can see in this particular example 1222232 (part of the M(8, 5, 2)) is invalid, and because of that it increases the probability of both sibling nods by 50%. One of siblings represents situation where both minions are dead. So despite no "lethal" in invalid nod, it increases probability of the nod with lethal damage on both minions.
Lets look at the 280 valid combinations that kill both minions. Probability of each depends on when first minion and when 2nd minion dies:
(1/3)^7 * (1/2) * (number of combinations where 1st minion dies after 7th missile) + (1/3)^6 * (1/2)^2 * (number of combinations where 1st minion dies after 6th missile and the other one after 8th) + (1/3)^5 * (1/2)^3 * (number of combinations where 1st minion dies after 5th missile and the other one after 8th) + (1/3)^4 * (1/2)^4 * (number of combinations where 1st minion dies after 4th missile and the other one after 8th) + (1/3)^3 * (1/2)^5 * (number of combinations where 1st minion dies after 3rd missile and the other one after 8th) + (1/3)^6 * (1/2) * 1 * (number of combinations where 1st minion dies after 6th missile and the other one after 7th) + (1/3)^5 * (1/2)^2 * 1 * (number of combinations where 1st minion dies after 5th missile and the other one after 7th) + (1/3)^4 * (1/2)^3 * 1 * (number of combinations where 1st minion dies after 4th missile and the other one after 7th) + (1/3)^3 * (1/2)^4 * 1 * (number of combinations where 1st minion dies after 3rd missile and the other one after 7th) =
So.. i was laddering on my NA account, and this situation occurred:
And the result:
I told myself: "Meh, this happens 11.86% of the time, not a big deal.. " :D
@jklsa: i'm glad to see you independently got the same result as i did. And your explanation is impressive. I thought that was me who spent too much time on this problem :P
@D00mL0rd: Looks like you might have some bug in your code. Care to share it?
def calc(): hp1 = 4 hp2 = 3 for i in range(8): if hp1 != 0 and hp2 != 0: choice = randint(0,2) elif hp1 == 0: choice = randint(1,2) elif hp2 == 0: choice = 2*randint(0,1) if choice == 0: hp1 -= 1 elif choice == 1: hp2 -= 1 return (hp1 == 0 and hp2 == 0)
iterations = 10000000 x = 0 for i in range(iterations): x += calc() print(x/iterations)
So what's going on here is I choose one of the possible outcomes for 8 shots. Choice 0 is minion 1, choice 1 is minion 2, choice 2 is the hero. calc returns a boolean value, but I just add it to a counter which equates to +1 for true and +0 for false.
There is no possibility of error in my code. I've ran simulations like this before on things that could be verified by formulas, and It was able to get the correct result to a very high degree of accuracy. Right now I'm running a simulation with 1,000,000,000 trials, but that's probably going to take another hour or so to finish.
Yup. Correcting now. This is a good example of why it's always good practise to make your boolean checks <= 0 even when it doesn't seem possible. My simulation is now getting an answer consistent with your formula.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
This pretty much clears it up, thank you for the correction, had a little error there :)
There are 280 favorable cases, but they are not equally likely. Did you account for that?
So i looked closer at it, and 406 are still not all the favorable cases.
M(8, 4, 3) - first minion is hit exactly 4 times, 2nd exactly 3 - all this possibilities are valid. 280 combinations.
M(8, 4, 4) - first minion is hit exactly 4 times, 2nd exactly 4 times - all this possibilities are invalid but add to the probability of killing both minions because the last shot on 2nd minion goes to the face, but both minions are still dead.
M(8, 5, 3) - same as above. That's 406 total combinations.
and now there are possibilities represented by:
M(8, 6, 2) - first minion is hit exactly 6 times, 2nd minion exactly 2 times. This scenario can actually also kill both minions, but not in all cases. Same goes for M(8, 7, 1), M(8, 5, 2) and so on. They sometimes kill both minions. If you add up all this cases i believe you would get my result.
Thats my point. There are invalid cases with 2 dmg on 3hp minion that increase probability of cases that kill both minions. I used my Paint skills to draw the tree :P
As you can see in this particular example 1222232 (part of the M(8, 5, 2)) is invalid, and because of that it increases the probability of both sibling nods by 50%. One of siblings represents situation where both minions are dead. So despite no "lethal" in invalid nod, it increases probability of the nod with lethal damage on both minions.
Lets look at the 280 valid combinations that kill both minions. Probability of each depends on when first minion and when 2nd minion dies:
(1/3)^7 * (1/2) * (number of combinations where 1st minion dies after 7th missile) + (1/3)^6 * (1/2)^2 * (number of combinations where 1st minion dies after 6th missile and the other one after 8th) + (1/3)^5 * (1/2)^3 * (number of combinations where 1st minion dies after 5th missile and the other one after 8th) + (1/3)^4 * (1/2)^4 * (number of combinations where 1st minion dies after 4th missile and the other one after 8th) + (1/3)^3 * (1/2)^5 * (number of combinations where 1st minion dies after 3rd missile and the other one after 8th) + (1/3)^6 * (1/2) * 1 * (number of combinations where 1st minion dies after 6th missile and the other one after 7th) + (1/3)^5 * (1/2)^2 * 1 * (number of combinations where 1st minion dies after 5th missile and the other one after 7th) + (1/3)^4 * (1/2)^3 * 1 * (number of combinations where 1st minion dies after 4th missile and the other one after 7th) + (1/3)^3 * (1/2)^4 * 1 * (number of combinations where 1st minion dies after 3rd missile and the other one after 7th) =
= (1/3)^7 * (1/2) * 120 + (1/3)^6 * (1/2)^2 * 70 + (1/3)^5 * (1/2)^3 * 36 + (1/3)^4 * (1/2)^4 * 15 + (1/3)^3 * (1/2)^5 * 4 + (1/3)^6 * (1/2) * 1 * 20 + (1/3)^5 * (1/2)^2 * 1 * 10 + (1/3)^4 * (1/2)^3 * 1 * 4 + (1/3)^3 * (1/2)^4 * 1 * 1 = 11.86556927297666%
I ran a simulation of the 4hp / 3hp minion event and they both die 10.23% of the time.
This was using the mersenne twister random number generator and had a sample size of 10,000,000 (so this number is super accurate).
So.. i was laddering on my NA account, and this situation occurred:
And the result:
I told myself: "Meh, this happens 11.86% of the time, not a big deal.. " :D
@jklsa: i'm glad to see you independently got the same result as i did. And your explanation is impressive. I thought that was me who spent too much time on this problem :P
@D00mL0rd: Looks like you might have some bug in your code. Care to share it?
from random import randint
def calc():
hp1 = 4
hp2 = 3
for i in range(8):
if hp1 != 0 and hp2 != 0:
choice = randint(0,2)
elif hp1 == 0:
choice = randint(1,2)
elif hp2 == 0:
choice = 2*randint(0,1)
if choice == 0:
hp1 -= 1
elif choice == 1:
hp2 -= 1
return (hp1 == 0 and hp2 == 0)
iterations = 10000000
x = 0
for i in range(iterations):
x += calc()
print(x/iterations)
So what's going on here is I choose one of the possible outcomes for 8 shots. Choice 0 is minion 1, choice 1 is minion 2, choice 2 is the hero. calc returns a boolean value, but I just add it to a counter which equates to +1 for true and +0 for false.
There is no possibility of error in my code. I've ran simulations like this before on things that could be verified by formulas, and It was able to get the correct result to a very high degree of accuracy.Right now I'm running a simulation with 1,000,000,000 trials, but that's probably going to take another hour or so to finish.
Yup. Correcting now. This is a good example of why it's always good practise to make your boolean checks <= 0 even when it doesn't seem possible.
My simulation is now getting an answer consistent with your formula.