Page 2 of 3

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 1:13 am
by syntax53
we want your chance of winning at least 1, no matter how many chances and no matter what percent of winning you have with each chance.

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 2:16 am
by EvanElias
So do you mean, the chance of getting at least one item from a chest, but without regard to which item it is? Or do you mean the chance for a particular item?



If you mean the probability of getting a particular item:

If you have N chances, and each has a drop probability P (in terms of 0.0 to 1.0, rather than 0% to 100%), then the probability of getting the item one or more times is:

1 - [ (1.0 - P) ^ N ]



If you wanted to break this down more specifically, into the prob of getting 1 or more, prob of getting 2 or more, prob of getting 3 or more copies of that item, etc... that's very doable with probability, but is a pain in the butt since it involves summations and combinatorials, if i remember correctly. These are easy to code (summations = simple loops in code) but are a major pain to write out readably in html.



If you mean the chance of getting any item, as opposed to a particular item:

This is a bit hard to do abstractly because of the number of variables involved... if you give a particular example of a chest and its drop chances / number of chances, I can help figure it out from there and hopefully explain a generic/abstract version w/o specific numbers...

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 3:33 am
by Shaddow
:ehh: I HATE MATH. :D

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 3:57 am
by Raybdbomb
[QUOTE=EvanElias]...combinatorials...[QUOTE]



that's a george w. bush word, if i ever heard one



where i learned, we called it combinations :P

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 8:58 am
by syntax53
evan, you seem on the right track with the 1.0 - [(1.0 - P)^N] but i don't think that works in our case because P is not always the same. or if i'm just reading it wrong, what would be the probably of winning at least once with three tries; a 90 percent chance, a 40 percent chance, and a 25 percent chance?

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 10:01 am
by EvanElias
[QUOTE=EvanElias]...combinatorials...[QUOTE]



that's a george w. bush word, if i ever heard one



where i learned, we called it combinations :P



same thing... combinations, combinatorial expansions, combinatorics, "n choose k", same thing... all valid terms :)

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 10:10 am
by EvanElias
evan, you seem on the right track with the 1.0 - [(1.0 - P)^N] but i don't think that works in our case because P is not always the same. or if i'm just reading it wrong, what would be the probably of winning at least once with three tries; a 90 percent chance, a 40 percent chance, and a 25 percent chance?



ah, ok. Say that you have 3 different P's, let's call them P1, P2, P3. Then your chance of getting the item at least once should be:



1.0 - [ (1.0 - P1) * (1.0 - P2) * (1.0 - P3) ]



which is basically just a more general form of the other answer.



So in the case of your example, it'd be

1.0 - [ (1.0 - 0.9) * (1.0 - 0.4) * (1.0 - 0.25) ]



= 1.0 - [ 0.1 * 0.6 * 0.75 ]

= 1.0 - .045

= 0.955

= 95.5% chance of getting the item at least once.



Basically the way this works is by taking 1.0 - [chance of not winning any trials], which actually equals the chance of winning at least one trial. So in the above example, there's a 4.5% chance of not getting the item, which therefore means a 95.5% chance of getting the item at least once. (Hopefully this makes sense, math at 9am hurts my head too ;)

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 10:19 am
by syntax53
ah, ok. Say that you have 3 different P's, let's call them P1, P2, P3. Then your chance of getting the item at least once should be:



1.0 - [ (1.0 - P1) * (1.0 - P2) * (1.0 - P3) ] = 95.5% chance of getting the item at least once.



yeah this seems to be it. at just about the same time i figured out how someone else was explaining it too on an email list:



THE SETUP:

Say you have a 100 sided die. You will roll this die 3 times

regardless of outcome. The first time you roll the die, you're

looking for any number from 1-90 (90% chance), the second time you're

looking for any number from 1-40 (40% chance), and the third time

you're looking for any number from 1-25 (25% chance).



THE QUESTION:

1) What is the probability that you will make your goal on any

number of rolls?



THE MATH:

1) The way this question is oriented success is measured by making

the goal only once out of all three rolls. Therefore the probability is

of there being at least one success and nothing more. First time I roll

the dice, I have a .9 chance of a success. That means that I have a .1

chance of failure. We are only concerned with the second roll if the

first does not succeed. Therefore, my chance of success on the second

roll is (.1)(.4) point four being the chance of

success on the second roll. This means that the chance for failure of

the first two rolls is (.1)(.6) which we then multiply by the

chance of success for the final roll creating the string

(.1)(.6)(.25). In order to get the overall probability of a single

success given these circumstances then the equation is as follows: (.9)

+ (.1)(.4) + (.1)(.6)(.25) which equals .955 or 95.5%

probability of a single success given the three rolls. This number does

not change whether or not the three rolls are done sequenciall! y or

simultaneously.



my code ends up looking like this:



nValue = ID number of "winning item"

nPercent = % chance of getting item within current "roll" / 100

nChestArray() = 3 dimensional array: 1st being ID, 2nd being current

probability, 3rd being current fail rate



If nValue > 0 Then



;first see if we are already recording values for this item

For x = 0 To UBound(nChestArray(), 2)



If nChestArray(1, x) = nValue Then



;set probability

nChestArray(2, x) = nChestArray(2, x) + (nChestArray(3, x) * nPercent)



;set new fail rate

nChestArray(3, x) = nChestArray(3, x) * (1 - nPercent)



x = -1

Exit For

End If

Next x



;if no match found above, add item and set probabilty

If x >= 0 Then

x = UBound(nChestArray(), 2) + 1

ReDim Preserve nChestArray(1 To 3, x)

nChestArray(1, x) = nValue ;ID

nChestArray(2, x) = nPercent ;probability

nChestArray(3, x) = 1 - nPercent ;failrate

End If



End If

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 10:57 am
by dreimas
well i had this whole thing prepared for you. But looks like someone answered before me. I could not get on the forums website yesterday, was like it was down or something all day. But i'll post anyways. Here's the equation, its irrelevent because it was already explained.



|A \/ B| = |A| + |B| - |A /\ B|

where \/ denotes union and /\ denotes intersection.

Re: Calling all Math Geeks (Chest Drop %)

Posted: Wed Jul 07, 2004 1:12 pm
by syntax53
here are some numbers to look at from my calculations. i even calculate for blocks the cast other blocks at a certain %. so if one block calls another block 10% of the time, it will dig into that as well. it will throw a % modifier on everything from the block though. so if something from that block has a 50% chance, it will be multiplied by .1. i allow the formula to nest within itself 10 levels. so if a block calls a block calls a block ... 10 times, you may as well forget about it anyway. and by that point you'd be looking at, ex. 50% * .00000025 or w/e chance anyway heh.



Chest info for massive wooden chest (908):

Item: adamantite chainmail hauberk - 18.6%

Item: adamantite platemail tunic - 18.6%

Item: aegis shield - 3.9%

Item: amethyst pendant - 9.6%

Item: ashwood staff - 9.6%

Item: astral gloves - 7.8%

Item: astral robes - 7.8%

Item: astral slippers - 3.9%

Item: astral trousers - 7.8%

Item: behemoth hide - 7.8%

Item: belt of might - 15.1%

Item: black potion - 11.5%

Item: black steel halberd - 9.6%

Item: bladed staff - 4.9%

Item: blue potion - 4.9%

Item: crimson bracers - 15.1%

Item: cure poison potion - 22.6%

Item: dragonscale armour - 3.9%

Item: dragontooth trident - 7.8%

Item: dwarven axe - 4.9%

Item: dwarven hammer - 4.9%

Item: eagle helm - 4.9%

Item: elven boots - 4.9%

Item: elven cloak - 4.9%

Item: ethereal amulet - 4.9%

Item: fine breastplate - 9.6%

Item: fine broadsword - 22.6%

Item: fine chainmail hauberk - 22.6%

Item: fine greatsword - 22.6%

Item: fine mace - 22.6%

Item: gauntlets of power - 15.1%

Item: gianthair vest - 22.6%

Item: gilded robes - 22.6%

Item: glowing broadsword - 9.6%

Item: glowing warhammer - 9.6%

Item: golden snake earrings - 4.9%

Item: golden vial - 7.8%

Item: great bronzewood club - 9.6%

Item: jade amulet - 4.9%

Item: lacquered battle armour - 18.6%

Item: long golden staff - 4.9%

Item: minor healing potion - 37.6%

Item: mithril chainmail hauberk - 3.9%

Item: mithril ring - 15.1%

Item: moonstone ring - 15.1%

Item: oaken staff - 22.6%

Item: ogre-skin shirt - 9.6%

Item: padded black boots - 9.6%

Item: prismatic gloves - 3.9%

Item: prismatic robes - 18.6%

Item: prismatic slippers - 3.9%

Item: prismatic trousers - 3.9%

Item: runed chainmail hauberk - 9.6%

Item: runed cowl - 9.6%

Item: runed robes - 9.6%

Item: sapphire ring - 4.9%

Item: serpent armbands - 4.9%

Item: serpent staff - 11.5%

Item: shadow cloak - 4.9%

Item: shimmering vial - 4.9%

Item: silversilk tunic - 3.9%

Item: silvery plate corselet - 22.6%

Item: silvery potion - 4.9%

Item: silvery shield - 9.6%

Item: skull shield - 18.6%

Item: starsteel bracers - 7.8%

Item: starsteel corselet - 3.9%

Item: starsteel greathelm - 7.8%

Item: starsteel mace - 18.6%

Item: starsteel plate boots - 3.9%

Item: starsteel plate gauntlets - 7.8%

Item: starsteel plate leggings - 7.8%

Item: starsteel shortsword - 7.8%

Item: stormhammer - 7.8%

Item: sunsword - 18.6%

Item: three-headed flail - 4.9%

Item: turquoise potion - 8.6%

Item: vorpal sword - 7.8%

Item: white potion - 4.9%

Item: wicked bone scythe - 7.8%

Item: yellow potion - 4.9%





Chest info for crimson chest (2013):

Item: belt of the crimson flame - 19.6%

Item: crack - 14.3%

Item: crimson cloak - 38.6%

Item: crimson earrings - 27.1%

Item: crimson helm - 16.9%

Item: crimson scale gauntlets - 31.8%

Item: crimson scalemail leggings - 5.9%

Item: crimson scalemail tunic - 8.7%

Item: crimson spiked shield - 27.1%

Item: etched adamant broadsword - 27.1%

Item: etched adamant warhammer - 48.8%





Chest info for stone chest (1354):

Item: amethyst stone - 23.7%

Item: aquamarine stone - 25.2%

Item: beaded belt - 17.2%

Item: black opal - 31.1%

Item: black potion - 9.9%

Item: bloodstone - 31.1%

Item: bronze chakram - 5.9%

Item: carnelian stone - 31.1%

Item: crimson bracers - 12%

Item: diamond - 20.1%

Item: emerald - 20.6%

Item: emerald-studded bracelet - 9.8%

Item: fire opal - 22.1%

Item: gargantuan stone maul - 7.8%

Item: garnet - 25.2%

Item: giant spiked collar - 2%

Item: golden vial - 13.7%

Item: javelin - 9.8%

Item: lionskin belt - 9.8%

Item: mithril chain leggings - 5.9%

Item: mithril earrings - 5.9%

Item: mithril plate leggings - 4%

Item: mithril ring - 12%

Item: moonstone - 31.1%

Item: moonstone ring - 12%

Item: ogre bone bracelet - 4%

Item: onyx stone - 31.1%

Item: opal - 31.5%

Item: pearl - 25.2%

Item: piece of amber - 29.1%

Item: piece of crystal - 31.1%

Item: piece of jade - 40.2%

Item: red chitin shield - 9.8%

Item: ruby - 20.4%

Item: ruby earrings - 9.7%

Item: sapling longbow - 7.8%

Item: sharktooth trident - 17.2%

Item: stormhammer - 4%

Item: stormmetal scalemail tunic - 9.8%

Item: topaz stone - 25.2%

Item: trollskin boots - 15.4%

Item: turquoise potion - 18%

Item: wyvernhide pants - 9.8%

Item: wyvernhide tunic - 9.8%