d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Probability Scheme (javascript)
Add Reply New Topic New Poll
Member
Posts: 35,043
Joined: Mar 31 2010
Gold: 105,913.26
Aug 17 2019 02:43pm
I'll pay anyone who solves this for me whatever is fair on here.

This is a d2 related problem, if you don't know d2 this probably isn't for you :P


I have a rare item, affix generation goes as follows :

1-3 prefixes
1-3 suffixes
3-6 affixes (an affix is a prefix or a suffix)

chances for affix counts are :

3 -> 25%
4 -> 25%
5 -> 25%
6 -> 25%

The split for generating a new affix is always 50% prefix, 50% suffix

Given any number of affixes can be specified, what is the total probability of this combination?
Example :

The "Cruel" prefix has a probability of 1:279 in a vacuum.
no other prefix is specified
no other suffix is specified

This means cruel has a chance to spawn on every prefix roll (assuming the item spawns with enough prefixes)
It also means there's a possibility on every affix roll that they become a suffix instead (50%), but only if the item doesn't have the maximum number of suffixes specified.

I need a formula (in javascript ideally) that takes into account these factors. I have all the probabilities of each affix in a vacuum on hand.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Aug 17 2019 03:06pm
if you're talking about diablo 2, i think there's more to it than what you've described. off hand, they're subject to ilvl, and you can't have affixes from the same group (eg: Cruel + Ferocious)

Quote
Given any number of affixes can be specified, what is the total probability of this combination?


also, your example is a bit hard to understand compared to your prompt:

Quote

Example :

The "Cruel" prefix has a probability of 1:279 in a vacuum.
no other prefix is specified
no other suffix is specified


can you walk through this example? is the answer you're looking for 1:279? or are you looking for 0 because it's impossible to have "Cruel" prefix with nothing else?
Member
Posts: 35,043
Joined: Mar 31 2010
Gold: 105,913.26
Aug 17 2019 03:16pm
Quote (carteblanche @ Aug 17 2019 05:06pm)
if you're talking about diablo 2, i think there's more to it than what you've described. off hand, they're subject to ilvl, and you can't have affixes from the same group (eg: Cruel + Ferocious)



also, your example is a bit hard to understand compared to your prompt:



can you walk through this example? is the answer you're looking for 1:279? or are you looking for 0 because it's impossible to have "Cruel" prefix with nothing else?


think about it this way, you know you're going to flip at least 3 coins, you only care if you get one heads out of them. Even if you know you're going to get more flips and more outcomes, you don't care about them since you only care about the probability of getting that one occurrence of heads.
Item level is not part of this, nor is affix groups, all of that is already handled and the result is on hand (1:279) for that prefix roll.
It doesn't however take into account that more affixes will be rolled and it has the same 1:279 chance of appearing there.

In my example, I only care about the chance of getting cruel prefix on one of the prefixes. The item will absolutely spawn with 3-6 affixes. But I don't care about them, they could be bad stats, or good ones. It makes no difference since we're only caring about hitting cruel prefix.
And I don't have the answer for the example I gave, that's what I need solving :P

I'd imagine it's something like.

100% chance at getting 3+ affixes
75% chance at getting 4+ affixes
50% chance at getting 5+ affixes
25% chance at getting 6 affixes

at 6 affixes you're guaranteed to have the max prefixes
at 5 affixes you're guaranteed to have at least 2x prefixes

so 100% chance to get at least one prefix
so you get 1/279 chance at minimum. Then if we calculate the chance of getting another prefix roll is 50% then we can say the new probability is 2:279 or 1:139.5

This post was edited by laztheripper on Aug 17 2019 03:35pm
Member
Posts: 12,703
Joined: May 17 2013
Gold: 12,935.00
Aug 17 2019 03:44pm
Adding a new tool to harrogath? :baby:

Calculators already exist for this, maybe take a look at this? https://diablo3.in-game-.de/diablodb/affix_index.php?lang=en&version=lod&patch=111
remove the - characters.

You could change it for 1.14d with your own values.

This post was edited by Klexmoo on Aug 17 2019 03:52pm
Aug 17 2019 03:57pm
Inappropriate Post Content
Aug 17 2019 04:12pm
Inappropriate Post Content
Member
Posts: 35,043
Joined: Mar 31 2010
Gold: 105,913.26
Aug 17 2019 04:16pm
Quote (Klexmoo @ Aug 17 2019 06:12pm)
I haven't actually looked into it, just googled for 30 seconds.

Can you add me on Discord Klex#3053 in case you want to discuss this ? I don't know too much about the specifics of d2 roll probabilities, but I can do the math if you can help with the d2 related constants.


Yeah that's exactly all I need, cause the rules are well defined and I have all the input data you'll need
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll