3
$\begingroup$

I play a card game called Hearthstone and need the ability to do fast calculations on the fly. There is one type of probability that I can't seem to wrap my head around.

An example in-game would be the following: I have a spell card that shoots out 2 missiles. There are 2 enemies and I want to hit 1 of them. That means I have a 1/2 chance of hitting the one I want. However, I have 2 spell cards in my hand. What is a trick/fast way to calculate my chances of hitting the enemy at least once?

Another example: The opponent is running 2 cards in his deck that counter me - we'll call them Card(A). I know the odds of him having this card at the moment is 40%. However, there are also 2 other cards that counter me - we'll call them Card(B). The odds of him having Card(B) is also 40%.

As you can see, there's a 40% chance of having Card(A) and a 40% chance of having Card(B). Both will counter me so I need to know the chances of him having both Card(A) and Card(B).

There are a lot of situations in this game where there is a specific outcome and multiple events that have a probability to lead to that outcome such as the ones I referenced above. I need a quick way to calculate this on the fly.

An example of being able to calculate things on the fly is the odds of something happening back to back. For example, if I have two 1/2 chances, but I need them both to hit after each other it's simple. You just go 1/2 * 1/2 = 1/4 to figure out your odds. I need something quick and simple like this for the examples I listed.

I'm not very good at math. I've looked online, but all the solutions I've found are too advanced for me to understand. They usually have probability trees, formulas, or equations that I'm not able to understand since I don't have a formal education in mathematical probability.

If someone could explain this to me in a way that I can understand and am able to calculate and replicate with speed while I play I would be very grateful as this has been a question I've been looking to solve for far too long and it's very frustrating.

Thank you in advance

$\endgroup$
1
$\begingroup$

Just considering your first question, we need to clarify the meaning:

I have a spell card that shoots out 2 missiles. There are 2 enemies and I want to hit 1 of them. That means I have a 1/2 chance of hitting the one I want. However, I have 2 spell cards in my hand.

If you employ one of your spell cards, do you always hit one of the two enemies, but have no control over which one you hit?

Let's assume that using one of your cards has 50% chance of achieving your goal (whatever that is). This situation is like tossing a coin, and having your goal be "get heads to appear." In this case, having two spell cards is like having two coins to toss, and needing one appearance of heads to "win", or achieve your goal.

If you have two coins and need one appearance of heads, your chance of getting that is 3 in 4, or 75%. There are two scenarios (both of which lead to the same 75% figure:

Case 1: You toss the two coins (or deploy the two spells) without waiting to see the result of the first coin (or spell). In this case, there are 4 possible outcomes, all equally likely to occur. For clarity, I will call the two coins a nickel and a dime:

  • The nickel comes up heads, and so does the dime
  • Only the nickel comes up heads
  • only the dime comes up heads
  • neither coin comes up heads

Three of these four cases represent a "win," so the chances are 75%.

Case 2: You toss the nickel first, and only toss the dime if you didn't yet see heads (only deploy the second spell if the first on didn't work).

In this case, there are three outcomes: - The nickel comes up heads, and you stop there. This happens 50% of the time. In the other 50% of cases, we have two equally likely possibilities: - The nickel came up tails, and the dime is heads. This happens 25% of the time (just like in Case 1). - Both coins come up tails (25% of the time, just like case 1).

Again, the cases in which you see at least one head (at least one spell hits its mark) add up to 75%.


A common mistake is to enumerate three cases (two heads, two tails, one of each) and calculate a probability of 2/3, or 66.66%. The problem is that these three possibilities are not all equally likely.


If you want a general way to think about this problem, then think about the chance of failure, rather than success. As long as one attempt does not affect the others, you can multiply the chance of each attempt failing, to get the chance of all the attempts failing. So the chance of the first spell failing (1/2) , times the chance of the second spell failing (1/2) gives 1/2 * 1/2 = 1/4 as the chance of BOTH spells failing.

$\endgroup$
0
$\begingroup$

For the first bit consider why it's 1/4 for both to hit. There are four total outcomes:

Card 1 and Card 2 miss. (1/4)

Card 1 hits and Card 2 does not. (1/4)

Card 1 does not and card 2 hits. (1/4)

Card 1 and Card 2 hit. (1/4)

So you have 75% chance to hit your target with at least one of your two spells.

As to the other: if he has a 40% chance (4/10) of having A and 40% chance of having B this is exactly like the above: 4/10 * 4/10 = 16/100 chance of him having both card A and card B.

To determine the chances of either A or B (or both) you have to determine the probability of him having NEITHER A nor B: 6/10 * 6/10 = 36/100 so the chances of him having either A or B is 64%.

$\endgroup$
0
$\begingroup$

If you need to compute probabilities, you multiply sequential events. In other words, if you flip a coin 3 times in a row, the probability of heads is $\frac{1}{2}*\frac{1}{2}*\frac{1}{2}=\frac{1}{8}$. For something like you are doing, take a look at the probabilities of failure, since that is usually getting all possible failures sequentially. After you have the probability of failure, subtract that value from $1$ to get the probability of success: $$P(failure)+P(success)=1 \rightarrow P(success)=1-P(failure)$$ So for your case, the probability of both missiles failing is $\frac{1}{2}*\frac{1}{2}=\frac{1}{4}$. Thus, the probability of success is $1-\frac{1}{4}=\frac{3}{4}$.

Crazy Math Theory Below:

There is a probability distribution which deals with exactly this problem. It is called binomial distribution. What it does is compute the probability of something occurring whenever there are only two outcomes in a given event (such as a coin flip), but there is more than one event. You can think of it as a biased coin flip "heads counter".

The equation is as follows: $$b(x;p,n)={n\choose{x}}p^x(1-p)^{n-x}=\frac{n!}{(n-x)!x!}p^x(1-p)^{n-x}$$ Let me break this equation apart for you:

  • $n$: total number of attempts you will make (# of coin flips)
  • $x$: total number of desired outcomes (# of heads)
  • $p$: probability of desired outcome for one event (probability of coin coming up heads)

The first bit $n\choose x$ is number of combinations, it eliminates order dependence, so that:HHT,HTH,THH are all counted the same (2 heads, 1 tail).

The next term $p^x$ is the probability of getting the desired outcome $x$ times.

The final term is the probability of getting the undesired outcome $n-x$ times. Since there are only two possible outcomes for each event, the probability of the undesired outcome must be $1-p$, because the total probability of all outcomes in an event must add to $1$.

Thus, for your case, we need something slightly different, we want not the probability that the missile hits 1 out of 2 times, but at least 1 out of 2 times. Thus, we need to add the probability of hitting 1 out 2 times to the probability of hitting 2 out of 2 times. $$\sum_{x=1}^2 b(x;p=0.5,n=2)=\left(\frac{2!}{(2-1)!1!}(0.5)^1(1-0.5)^{2-1} \right)+\left(\frac{2!}{(2-2)!0!}(0.5)^2(1-0.5)^{2-2} \right)$$ $$(2(0.5)(0.5))+(1(0.5)^2(0.5)^0)=0.5+0.25=0.75$$ So in the end, you have a 75% chance of hitting at least but not exclusively once.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.