Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The probability calculation is more complicated than you think. The probability of winning is</p> <pre><code>P(win on 0th tick) + P(win on 1st tick) + ... + P(win on 10th tick) </code></pre> <p>Let's call the probabilities p(0) ... p(11). Then</p> <pre><code>P(win on 0th tick) = p(0) P(win on 1st tick) = (1-p(0)) * p(1) P(win on 2nd tick) = (1-p(0)) * (1-p(1)) * p(2) </code></pre> <p>etc. At each tick, the probability that you win on that tick is the probability that you didn't already win on any of the previous ticks, multiplied by the probability of winning <em>right now</em>.</p> <p>With the numbers you gave in your post, I think that your robot should win about 63.17% of the time (I am not sure why you are seeing about 30% - could this be a bug somewhere else in your program?)</p> <p>With the following numbers you should observe about a 90% success rate overall</p> <pre><code> 0 0 1 0.0068 2 0.0113 3 0.0188 4 0.0314 5 0.0524 6 0.0875 7 0.1459 8 0.2433 9 0.4059 10 0.6771 </code></pre> <hr> <p><strong>EDIT</strong></p> <p>How did I come up with these numbers? Trial and error. But we could invent a procedure that given any win probability, generates a suitable set of probabilities for each tick.</p> <p>Let's say that the total win probability is <code>Q</code>, so you want</p> <pre><code>P(Win on 0th tick) + ... + P(Win on 10th tick) = Q </code></pre> <p>Let's say we want there to be no chance of winning on the 1st tick, and a linearly increasing chance of winning on any tick after that. So the probabilities have to add up to Q, and the probability of the win coming at tick <code>i</code> is proportional to <code>i</code>. Therefore</p> <pre><code>P(Win on ith tick) = const * i </code></pre> <p>hence</p> <pre><code> c * 0 + c * 1 + c * 2 + ... + c * 10 = Q =&gt; 55 * c = Q =&gt; c = Q/55 </code></pre> <p>That gives us</p> <pre><code>P(Win on 0th tick) = 0 P(Win on 1st tick) = Q/55 P(Win on 2nd tick) = 2*Q/55 </code></pre> <p>etc. Now you use these to determine each of the <code>p(i)</code> using the formula at the top of the post. We have</p> <pre><code>p(0) = P(win on 0th tick) = 0 p(1) = P(win on 1st tick) / (1-p(0)) = Q/55 p(2) = P(win on 2nd tick) / (1-p(0)) / (1-p(1)) = 2*(Q/55) / (1-Q/55) </code></pre> <p>etc. Here's a Matlab routine that calculates the probabilities; it shouldn't be hard to translate it into C# or whatever you're using.</p> <pre><code>N = 10; Q = 0.9; p = zeros(N+1,1); for i = 1:N p(i+1) = i * Q/(0.5*N*(N+1)) / prod(1-p(1:i)); end </code></pre> <p>which gives this result</p> <pre><code> 0 0 1 0.0164 2 0.0333 3 0.0516 4 0.0726 5 0.0978 6 0.1301 7 0.1745 8 0.2416 9 0.3584 10 0.6207 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload