Dice rolling question

Doc requests, organization, and submissions

Moderators: dorpond, trevor, Azhrei

bobthedog
Cave Troll
Posts: 85
Joined: Sun Aug 03, 2008 7:17 pm

Dice rolling question

Post by bobthedog »

Okay, I'm basing this question on a situation I haven't experienced yet (and don't really think will happen too soon in my game even, but I just love theories)...

I'm talking about the Gauntlets of Destruction + Vorpal Weapon combo:

The Gauntlets allow you to reroll all dice from your melee damage that come up as 1. In the parser, that would look like XdYr2, I believe.

Vorpal weapons allow you to roll again whenever you get the maximum number on your damage dice, which would look like XdYe.

Question is: Can these features be mixed in the current parser? I have tried XdYr2e and XdYer2; both are accepted by the parser, but it ignores the second instruction (so XdYr2e = XdYr2, and XdYer2 = XdYe).

(Oh, and I got a roll of 23 out of a [1d4e] test roll.) :shock:

bobthedog
Cave Troll
Posts: 85
Joined: Sun Aug 03, 2008 7:17 pm

Post by bobthedog »

10 days and no answer? :(

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

bobthedog wrote:10 days and no answer? :(
Hmm, this might be a trick for an if statement...


I'll work on this and try come up with a way to make it work right.
0+0=1, for very unstable CPUs.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

Okay, this is only a partial solution, because you are indeed correct that the two functions do not play nice (HEY DEVS!!!).

So here's what you can do:

Code: Select all

[pR=1d4r2][if(pR==4, 1d4r2+4, pR) ]
Which gives:

Code: Select all

«pR=1d4r2 = pR = 4 = 4 »« if(pR==4, 1d4r2+4, pR) = 6 »
The problem is this: if the vorpal weapon is supposed reroll on a second four you are stuck because you need a loop, and maptool doesn't support that yet. Until we get scripting language support, loops are likely out of the question. You could do a nested if for multiple layers, but that's only going to take you so far...

Here's an example (for two levels):

Code: Select all

[pR=1d4r2][if(pR==4, if(1d4r2==4, 1d4r2+8, pR+4), pR) ]
which gives this as a possible output:

Code: Select all

« pR=1d4r2 = pR = 4 = 4 »« if(pR==4, if(1d4r2==4, 1d4r2+8, pR+1d4r2), pR) = 11 »
Again, though, you need to be careful, because this only goes as many levels as you nest it, and I think beyond two levels it gets VERY tricky, and my logic may be just a bit off (actually I KNOW it is because there is a problem in the code that I'm not sure how to get around. Maybe mathemagician will pop in here and try to figure this out?). Hmm... See if you can spot the problem.
0+0=1, for very unstable CPUs.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

Code: Select all

[dR=1d4r2][pR=1d4r2][if(pR==4, if(dR==4, 1d4r2+8, pR+dR), pR) ]
that's the ugly fix for my code, but it's NOT A GOOD SOLUTION, because here's what three levels looks like:

Code: Select all

[cR=1d4r2][dR=1d4r2][pR=1d4r2][if(pR==4, if(dR==4, if(cR==4,1d4r2+12, pR+cR+dR), pR+dR), pR) ]
It's getting uglier. It's not UNWORKABLE, and I've SEEN MUCH WORSE, but really? It's not really what you want, since it is limiting. I mean, what if they roll another 4? Shouldn't they do more damage? Here's my SECOND roll:

Code: Select all

« cR=1d4r2 = cR = 4 = 4 »« dR=1d4r2 = dR = 4 = 4 »« pR=1d4r2 = pR = 4 = 4 »« if(pR==4, if(dR==4, if(cR==4,1d4r2+12, pR+cR+dR), pR+dR), pR) = 15 »
A FIFTEEN! Sweet! But that's a big problem!

Really, until we have looping, there is no fix.
0+0=1, for very unstable CPUs.

Richard Weimer
Cave Troll
Posts: 62
Joined: Mon Jun 12, 2006 4:39 pm
Location: Peoria, AZ

Post by Richard Weimer »

Maybe you're not considering that a 1d4 weapon that re-rolls all 1's is identical to a weapon that does 1d3+1 damage? Wouldn't that work easier, or am I missing something?

User avatar
TK
Giant
Posts: 162
Joined: Fri Jun 27, 2008 12:02 am

Post by TK »

the problem is, if the die explodes, you need to also add 1 for every reroll, which there really isn't a way to do other than massive nested if statements right now.

Although if I think about it...
damage = 1d3
damage = damage + celling(damage/3)

may just work

but, since you need 2 macro lines to do this, it would make integrating with pre-built macros very difficult.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

Richard Weimer wrote:Maybe you're not considering that a 1d4 weapon that re-rolls all 1's is identical to a weapon that does 1d3+1 damage? Wouldn't that work easier, or am I missing something?
Actually, from a statistical standpoint, I think that's probably correct, I wonder if the die roller would handle that better?

However, from a purely mathematical standpoint, that is not the same as 1d4e, especially when the d4 has two chances of being rolled twice. I'm a bit fuzzy on my probability logic, so I'm not going to go into the details of it, but I'm CERTAIN that 1d4r2e is probabalistically different than 1d3e+1 (or however you choose to write that).

I'll leave the exact probabilities to people more inclined to the exact numbers--I'm far too likely to make a serious error, but I'm going to state for the record that while I as a DM would allow the switch, I would do it knowing that I am screwing with the probabilities in this case. But if you are going up to say a 1d8r2e, then you have a BIG problem. D7e+1 works, but the probabilities are different, and I'm not sure HOW different. The bigger the die, the LESS certain I am that I would allow it. Or maybe I would disallow it on smaller dice, but allow it on bigger dice, I'm not certain. But you are changing the chances of BIG damage, and that's something a DM needs to be aware of.
0+0=1, for very unstable CPUs.

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

TK wrote:the problem is, if the die explodes, you need to also add 1 for every reroll, which there really isn't a way to do other than massive nested if statements right now.

Although if I think about it...
damage = 1d3
damage = damage + celling(damage/3)

may just work

but, since you need 2 macro lines to do this, it would make integrating with pre-built macros very difficult.
And you are right too...dangit!

Ah, the problems with this.
0+0=1, for very unstable CPUs.

Richard Weimer
Cave Troll
Posts: 62
Joined: Mon Jun 12, 2006 4:39 pm
Location: Peoria, AZ

Post by Richard Weimer »

Orchard wrote: However, from a purely mathematical standpoint, that is not the same as 1d4e, especially when the d4 has two chances of being rolled twice. I'm a bit fuzzy on my probability logic, so I'm not going to go into the details of it, but I'm CERTAIN that 1d4r2e is probabalistically different than 1d3e+1 (or however you choose to write that).
Maybe I'm not thinking straight. The probability of rolling any particular number on a die is the same as any other (discounting slight variance with the particular die in question such as balance, smoothness, center of gravity, etc.).

So, the odds of rolling either a 2, 3, or 4 on a d4 are all the same. Isn't that, by definition, a d3? All that you're varying by increasing the die size is the probability of the die having to be re-rolled because it did not roll a 2, 3, or 4 on its previous roll. I could, for instance, roll a percentile (1d100) die, and reroll any values other than a 2,3, or 4, and have the same probability of any of these three numbers being rolled when I'm done (although the amount of rerolls doing so would be horrendous.. :cry: )
Last edited by Richard Weimer on Fri Aug 15, 2008 2:33 pm, edited 2 times in total.

Richard Weimer
Cave Troll
Posts: 62
Joined: Mon Jun 12, 2006 4:39 pm
Location: Peoria, AZ

Post by Richard Weimer »

Orchard wrote:
TK wrote:the problem is, if the die explodes, you need to also add 1 for every reroll, which there really isn't a way to do other than massive nested if statements right now.

Although if I think about it...
damage = 1d3
damage = damage + celling(damage/3)

may just work

but, since you need 2 macro lines to do this, it would make integrating with pre-built macros very difficult.
And you are right too...dangit!

Ah, the problems with this.
It sounds possible, but I'm not familiar enough with the macro script to see how easy this would be to implement. Good catch, though.

User avatar
TK
Giant
Posts: 162
Joined: Fri Jun 27, 2008 12:02 am

Post by TK »

Orchard wrote:
Richard Weimer wrote: However, from a purely mathematical standpoint, that is not the same as 1d4e, especially when the d4 has two chances of being rolled twice.
While this makes sense at first, I have to disagree with you. You do not really get 2 chances to roll the highest number on the die, since you only reroll the die when you roll a 1. So the only roll that really matters is the roll that you don't roll a 1 on.

Another way to think of this is to say to yourself "The probability of me rolling a 4 on a d4 when I know that I rolled a 1 is 0%". Then on your reroll, you have an equal probability of rolling any of the numbers.

User avatar
Mathemagician
Dragon
Posts: 666
Joined: Tue May 22, 2007 2:27 pm

Post by Mathemagician »

1d3+1 is statistically the same as 1d4 reroll 1s, at least, I think so :).

However, 1d3e+1 does not achieve what you want. It needs to be 1d3e+(n+1), where n is the number of times the explode rerolled on a 3.

So...

{damage=1d3e}
{damage= damage+ceil(damage/3)}

Should do it, as was proposed above, without the e :P

User avatar
Orchard
Great Wyrm
Posts: 1852
Joined: Fri May 09, 2008 10:45 am
Location: Doylestown PA
Contact:

Post by Orchard »

Richard Weimer wrote:
Orchard wrote: However, from a purely mathematical standpoint, that is not the same as 1d4e, especially when the d4 has two chances of being rolled twice. I'm a bit fuzzy on my probability logic, so I'm not going to go into the details of it, but I'm CERTAIN that 1d4r2e is probabalistically different than 1d3e+1 (or however you choose to write that).
Maybe I'm not thinking straight. The probability of rolling any particular number on a die is the same as any other (discounting slight variance with the particular die in question such as balance, smoothness, center of gravity, etc.).

So, the odds of rolling either a 2, 3, or 4 on a d4 are all the same. Isn't that, by definition, a d3? All that you're varying by increasing the die size is the probability of the die having to be re-rolled because it did not roll a 2, 3, or 4 on its previous roll. I could, for instance, roll a percentile (1d100) die, and reroll any values other than a 2,3, or 4, and have the same probability of any of these three numbers being rolled when I'm done (although the amount of rerolls doing so would be horrendous.. :cry: )
I disagree.

Yes the odds of rolling a 2, 3, or 4 on a d4 are the same--BUT this is NOT the same as a d3 because the chances of rolling those on a d4 is, and always will be 25%. There is a probability path here. You have 2 ways to reach a 4, two ways to reach a 3, two ways to reach a 2, and 0 ways to reach a 1. The question is, do you KEEP rerolling ones or not? If the answer is yes, then we have an infinite regression loop, and I THINK you are back to the 33% probabilities. Maybe. I can't really tell because my logic isn't that good. But if you DO not re-roll ones, then it's a very different story.

So then it's

4-->2 ways
3-->2 ways
2-->2 ways
1-->1 way
-------------
4 sides. ACK! You do the math! 9/4ths?

That is not the same as a d3 at all.

But if we go back to rerolling ones an infinite number of times, I think we regress to the d3 situation, but I'd want to see a mathematical proof of that. That said, I'm not certain I have the knowledge to write one.
0+0=1, for very unstable CPUs.

User avatar
TK
Giant
Posts: 162
Joined: Fri Jun 27, 2008 12:02 am

Post by TK »

Orchard wrote: So then it's

4-->2 ways
3-->2 ways
2-->2 ways
1-->1 way
-------------
4 sides. ACK! You do the math! 9/4ths?

That is not the same as a d3 at all.
The issue here is that you are saying that each "way" you can roll a 4/3/2 is of equal probability. On my first roll, I have a 25% chance of rolling a 4. If I roll a 1, (which I had a 25% chance to do) then I have a 25% chance to roll a 4 on that roll, but for the overall probability I need to multiply it by the probability of a reroll (so 25% * 25%). If it so happens that I roll a 1 a third time, then I have 25% of rolling a 4 on the third reroll...

So we would write this as a sum for n=1 to infinity of 1/4^n.

This sum approaches 33%, which also happens to be the chance of you rolling a 3 on a d3

Post Reply

Return to “Documentation Requests/Discussion”