Need help with creating a probability based Java application

Hello everyone!

I'm new here, and admitidly maths has never been my strong point, so I'm gonna need your help to solve a problem I'm having;

For homework as a university student I'm told to go and program to my hearts content over the summer, I've decided to create a warhammer program that calculates the probability of a certain outcome occuring.

So I think I should explain how the game called warhammer works;

You roll a dice to "hit", for example to "hit" you need to score a 3 or over (3+)

You roll a dice to "wound", for example to "wound" you need to score a 4 or over (4+)

You roll a dice (well, the other person does) to "save", for example to "save" you need to score a 5 or over (5+)

If the first player hits, and also wounds, the other players gets the opportunity to save it (and then nothing else happens if they save it).

So what I have so far is those 3 events are independant of each other, so I would calculate the odds by multiplying the odds for each event occuring.

I.e. for the example given above;

2/3 (0.66) to hit

3/6 (0.5) to wound

1/3 (0.33) to save

0.66 * 0.5 * 0.66 (the odds NOT to save it, as this is from only the attacking players perspective) = 0.2178 So 21% odds for a single attack to hit, wound, and for the other person not to save it.

But what confuses me, is how I could calculate the probability of not just one attack (attempt at hitting and wounding e.g.) but numerous attempts at doing so. For example, say I have 3 attempts, what are the odds of at least one of those attempts being sucessfull?

Would I multiply the 21% by another 21%? Would I just multiple the 21% by the amount of attempts the player has?

I hope I haven't bored you and that you understand

Thanks in advance

Re: Need help with creating a probability based Java application

Quote:

Originally Posted by

**subwayhell** Hello everyone!

I'm new here, and admitidly maths has never been my strong point, so I'm gonna need your help to solve a problem I'm having;

For homework as a university student I'm told to go and program to my hearts content over the summer, I've decided to create a warhammer program that calculates the probability of a certain outcome occuring.

So I think I should explain how the game called warhammer works;

You roll a dice to "hit", for example to "hit" you need to score a 3 or over (3+)

You roll a dice to "wound", for example to "wound" you need to score a 4 or over (4+)

You roll a dice (well, the other person does) to "save", for example to "save" you need to score a 5 or over (5+)

If the first player hits, and also wounds, the other players gets the opportunity to save it (and then nothing else happens if they save it).

So what I have so far is those 3 events are independant of each other, so I would calculate the odds by multiplying the odds for each event occuring.

I.e. for the example given above;

2/3 (0.66) to hit

3/6 (0.5) to wound

1/3 (0.33) to save

0.66 * 0.5 * 0.66 (the odds NOT to save it, as this is from only the attacking players perspective) = 0.2178 So 21% odds for a single attack to hit, wound, and for the other person not to save it.

But what confuses me, is how I could calculate the probability of not just one attack (attempt at hitting and wounding e.g.) but numerous attempts at doing so. For example, say I have 3 attempts, what are the odds of at least one of those attempts being sucessfull?

Would I multiply the 21% by another 21%? Would I just multiple the 21% by the amount of attempts the player has?

I hope I haven't bored you and that you understand

Thanks in advance

It is 1 minus the probability that all miss, and the probability that they all miss is the product of the probabilities that they individually miss.

CB