Talk:Carefree Melody/@comment-44496691-20191124153036

Hello guys,

I think the maths are incorrect on the chance of not being hit ! (The problem is quite tricky and involves Markov Chains which is pretty advanced maths).

The correct probability is 900000000/4194230400 or  21.458048656% chance of not being hit. I ran some simulations (500 0000times) and got the same number (21.45804865655451%).

Here are the detailed explanations on how to solve the problem. Beware maths incoming.

First lets create a state machine :

A0 is the state right after having blocked one hit. A1 after getting hit once, A2 twice etc... A9 is after getting hit at least 9 times.

So if you are in state A0 the chance of going to state A1 is 100%.

When in A1 you have 10% chance to go into A0 (blocking one hit) and 90% into A2 (not blocking).

Let's note p(A0) the probability of being in state A0 after infinitely many iterations. Then p(A1) is the same as p(A0). Because only A0 can lead to A1 and there is a 100% chance.

p(A2) = (9/10) p(A1)=(9/10)p(A0).

p(A3)= (8/10)p(A2)=(9*8/100)p(A0).

So you can trivially express the probabilities of all states from A1 to A8 by A0 only.

Now for A9 we have

p(A9)= (2/10)p(A8)+(1/10)p(A9)

Which can be rewritten

p(A9)*(9/10)= (2/10)p(A8).

And you have all probabilites of A0 to A9 expressed with A0.

Now since the probabilities of being in one of the 10 states (A0 to A9) is 1 (because A0 to A9 forms a partition) you can compute p(A0). p(A0) ends up being 900000000/4194230400 or 21.4%. p(A0) is also the probability of blocking a hit at the previous iteration. (If and only if you blocked at the previous iteration you end up in A0). Now since we assumed we have done an infinite number of iterations, p(A0) at iteration n is equal to p(A0) at iteration n-1. So p(A0) is the number we are looking for!