Question: A large group of zombies are coming towards you and there are three machine guns near you. Each machine gun has a different probability of firing bullets (say gun no 1 fires 1 bullet properly out of n bullets, on an average). You can operate one gun at a time and you do not know probability of firing bullets of any of the guns. What should be your strategy to attack zombies.

Answer: Since we do not know the probability of firing of any gun, we need to choose a gun randomly. We can fire certain number of bullets, lets say n, and estimate the probability of firing. We then switch to other guns, firing them n times, and estimate their probabilities of firing.

Let the estimated probabilities of three guns be P1, P2 and P3. Without loss of generality we can assume P1 >= P2 >= P3.

One strategy could be to use gun with probability P1 all the time. But since these are just estimated probability, on the basis of small sample set of size n, true probabilities could be different and change our decision.

Higher the size of sample, n, more closer our estimated probabilities will be to the true probabilities. But if n is very large, we might waste too much time on inefficient guns.

A better strategy could be using Gun1 100*P1/(P1 + P2 + P3) percent times, Gun2 100*P2/(P1 + P2 + P3) percent times and Gun3 100*P3/(P1 + P2 + P3) percent times in a sample size of 3n. After using all three guns we can update the probabilities P1, P2, P3 and use the updated probabilities to choose guns and continue switching the guns in similar manner.