[QUIZ] Dice Roller (#61)

Actually, you're right, but actually my post was a half-joke. The
munchkin players seem to roll 18's every time. :wink:

ยทยทยท

On 1/6/06, Will Shattuck <willshattuck@gmail.com> wrote:

On 1/6/06, Matthew Moss <matthew.moss.coder@gmail.com> wrote:
> Ha ha... Must have copied the wrong line when writing up the quiz
> description.
>
> That should look like this:
>
> > roll.rb "3d6" 6
> 18 18 18 18 18 18
>

Actually 3d6 means roll a 6 sided die 3 times so you would have a result of 3-18

18 was the best stat a starting character could have. If you got one, they let you roll d% and put it after the slash (the higher the better). 00 == 100. So characters with 18/00 had some damn lucky die rolls. :slight_smile:

James Edward Gray II

ยทยทยท

On Jan 6, 2006, at 2:21 PM, J. Ryan Sobol wrote:

I guess that must be a D&D inside half-joke because I'm totally confused.

forgive my ignorance... BNF?

HTH,

Bill

Na, if you get a 1 on the tens die and a 3 on the ones die, you have rolled a 13.

James Edward Gray II

ยทยทยท

On Jan 6, 2006, at 5:04 PM, Sascha Abel wrote:

< One gaming system developed by Gary Gygax after he was ousted

from TSR in the mid-80s used what he termed d10x, which was d10*d10,
resulting in values from 1 - 100 with a radically different probability
curve than a normal d100.

Not only a different curve, but also some values would be impossible to
get (as 13 and 51)

Austin Ziegler wrote:

No. d00/d%/d100 all refer to values from 1 to 100. It should be
considered impossible to get a value of 0 from dice. Strictly
speaking, d100 should be a special case simulated where you are
rolling two d10 values and treating one of them as the 10s and one of
them as the 1s. Again, it results in a slightly different curve than
a pure d100 result would be.

How exactly would those d10s differ from a d100?

In the same way that 3d6 is different than rand(16)+3. It's not
necessarily as dramatic a difference, but IME, the incidences of the
very lows (01-19) and very highs (81-00) are not as common as those in
the middle.

One gaming system developed by Gary Gygax after he was ousted from
TSR in the mid-80s used what he termed d10x, which was d10*d10,
resulting in values from 1 - 100 with a radically different
probability curve than a normal d100.

Not only a different curve, but also some values would be impossible
to get (as 13 and 51)

Yes.

-austin

ยทยทยท

On 06/01/06, Sascha Abel <sascha.abel@ewetel.name> wrote:
--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

A zero on the tens dice is 10. On the one's dice, it's zero. 00 is 100.

James Edward Gray II

ยทยทยท

On Jan 6, 2006, at 5:35 PM, Jim Freeze wrote:

What do you need to roll to get a 0 and 100?

1+2*3 == (1+2)*3 == 9?

You may want to review the precedence order again.

         * All binary operators are left-associative.
         * Operator precedence:
                  ( ) highest
                  d
                  * /
                  + - lowest

Resolve precedence before associativity.

So 1+2-3 == (1+2)-3 because + and - have the same precedence.

But 1+2*3 == 1+(2*3) because * has precedence over +.

Min: (5*1-4)*(1)+3 = 1*1+3 = 5
Max: (5*5+4)*(16/4)+3 = 29*4+3 = 119

The min for ndm is always n, because all dice start at 1.
The max for ndm is n*m.

ยทยทยท

On Jan 7, 2006, at 5:03 AM, Christian Neukirchen wrote:

"Matthew D Moss" <matthew.moss.coder@gmail.com> writes:

Hopefully this ASCII art comes through clean:

Parse tree for: (5d5-4)d(16/d4)+3

                _______________ + _______________
                > >
        _______ d _______ 3
        > >
    ___ - ___ ___ / ___
    > > > >
___ d ___ 4 16 ___ d ___
5 5 1 4

So what are the maximum and minimum values of this?

In article <m2fyo0gs8o.fsf@lilith.local>,

"Matthew D Moss" <matthew.moss.coder@gmail.com> writes:

> Hopefully this ASCII art comes through clean:
>
> Parse tree for: (5d5-4)d(16/d4)+3
>
> _______________ + _______________
> > >
> _______ d _______ 3
> > >
> ___ - ___ ___ / ___
> > > > >
> ___ d ___ 4 16 ___ d ___
> 5 5 1 4

So what are the maximum and minimum values of this?

Notation: [x,y] is any distribution with minimum x and maximum y. I then
get:

(5d5-4)d(16/d4)+3 = (adb = [a,a*b], so 5d5 = [5,25])

([5,25]-4)d(16/d4)+3 = ([x,y] - c = [x-c,y-c])

([1,21])d(16/d4)+3 = (adb = [a,a*b], so d4 = 1d4 = [1,4])

([1,21])d(16/[1,4])+3 = (c/[x,y] = [c/y,c/x] if x and y > 0)

([1,21])d([4,16])+3 = ([a,b]d[c,d] = [a*c,b*d] if a,b,c, and d > 0)

[4,336]+3 = ([x,y] + c = [x+c,y+c])

[7,339]

Reinder

ยทยทยท

Christian Neukirchen <chneukirchen@gmail.com> wrote:

Gregory Seidman a รฉcrit :

} Matthew Moss a ?crit :
} > Wow... You guys are just having too much fun with
} > "(5d5-4)d(16/d4)+3", I think. Heck, if y'all know Ruby so well (more
} > than me, cause I'm still such a n00b), you'd be able to swap in loaded
} > dice for random dice and get your min's and max's. =)
} >
} > Anyway, I just wanted to add a couple of notes. It was made aware to
} > me that the simplified BNF (in the original post) is slightly in
} > error, in that it allows expressions like this:
} >
} > 3dddd6
} >
} > which is invalid.
} >
} > A couple possible fixes:
} >
} > 1. Use the expanded BNF I posted, which doesn't have this fault.
} > 2. Implement your dice parser using right-associativity for 'd'
} > operators (but maintain left-assoc for the other binary operators).
} >
} > Feel free to do what you like.
} >
} >
}
} Well, why do you say it's invalid ? Given the simplified BNF it must be
} read as :
}
} 3d(d(d(d6)))
}
} and it is perfectly valid as there is no other way to understand that ...

That is only true if the d operator is right-associative. According to the
original spec, it is left-associative and, therefore, 3dddd6 is a syntax
error. Mind you, the second option Matthew gave is to make it
right-associative, which is what you have done. I chose to treat it as a
syntax error.

Well, I disagree ...
As I see the things, there are two "d" operators :
- one left-associative infix operator (i.e. 3d6)
- one prefix operator (i.e. d6)

The first "d" in your example is the infix one, thus left-associative,
while the other ones are prefix ... and there is nothing to tell about
association as they get only one argument ...

If I'm not clear enough, I hope it will be when we will be allowed to
disclose our solutions :wink:

Pierre

ยทยทยท

On Sun, Jan 08, 2006 at 10:48:01PM +0900, Pierre Barbier de Reuille wrote:

} Pierre
--Greg

In fact, I've seen a variation on this for the infamous "d3" somtimes
used in D&D. The standard approach is to roll a d6 then divide the
result by two (rounding up). However, one dice seller instead offers a
non-regular tetrahedron where one vertex is stretched out away from
the fourth side. This makes the three stretched side much more likely
than the fourth side, and given the dynamics of the dice, it is very
unlikely for it to land standing on that fourth side. So you have, in
effect, a three sided die. If the fourth side does ever come up, you
just reroll.

Jacob Fugal

ยทยทยท

On 1/7/06, Ron M <rm_rails@cheapcomplexdevices.com> wrote:

Austin Ziegler wrote:
> Novelty dice created in the past include:
>
> d30, d100
>
> The latter is quite unwieldy.
>
> Strictly speaking, it is not possible to make a die (polyhedron) with an
> odd number of faces,

Uh, of course you can make such a polyhedron. Consider the
Egyptian and Mayan pyramids as examples of 5-sided polyhedron
(four triangles on the sides and a square on the bottom).
Adjusting the steepness of the sides can make it as fair
or unfair as you'd want.

Sure, they're not regular polyhedra, but neither is the d30 you spoke of.

James Edward Gray II wrote:

I think I'd really like to see a production quality parser(generator) using something like this grammar format.

I agree. This is fantastic.

Thanks :slight_smile:

So what do we have to do to get you to add the polish and make it available? :slight_smile:

I have put it on my mental to-do list, but that doesn't necessarily mean that I actually get around to doing it. :wink:
Right now the grammar is subject to quite some restrictions that I would like to remove, but I'll need to learn more about parser generators to do this.

Dennis

In most versions of D&D/AD&D, this was also limited to Strength attributes only.

This may have changed recently. :wink:

-austin

ยทยทยท

On 06/01/06, James Edward Gray II <james@grayproductions.net> wrote:

On Jan 6, 2006, at 2:21 PM, J. Ryan Sobol wrote:

I guess that must be a D&D inside half-joke because I'm totally
confused.

18 was the best stat a starting character could have. If you got
one, they let you roll d% and put it after the slash (the higher the
better). 00 == 100. So characters with 18/00 had some damn lucky
die rolls. :slight_smile:

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

I misread. Sorry.

James Edward Gray II

ยทยทยท

On Jan 6, 2006, at 5:10 PM, James Edward Gray II wrote:

On Jan 6, 2006, at 5:04 PM, Sascha Abel wrote:

< One gaming system developed by Gary Gygax after he was ousted

from TSR in the mid-80s used what he termed d10x, which was d10*d10,
resulting in values from 1 - 100 with a radically different probability
curve than a normal d100.

Not only a different curve, but also some values would be impossible to
get (as 13 and 51)

Na, if you get a 1 on the tens die and a 3 on the ones die, you have rolled a 13.

That's for d%; I was referring to "Cyborg Commando" which had a d10x,
which is (d10)*(d10), making a 1,3 combination 3 always. You'd never get
a prime number larger than 7 under the d10x system.

  combo = Hash.new(0)

  1.upto(10) { |i|
    1.upto(10) { |j|
      combo[i * j] += 1
    }
  }

There are 42 possible values here, and 9 values (6, 8, 10, 12, 18, 20,
24, 30, 40) appear four times each. Four values (4, 9, 16, 36) appear
three times each, 23 values twice each, and 6 values once.

It was a truly fucked up system. I think it's because he was mad to be
ousted.

-austin

ยทยทยท

On 06/01/06, James Edward Gray II <james@grayproductions.net> wrote:

On Jan 6, 2006, at 5:04 PM, Sascha Abel wrote:
I wrote:
>> One gaming system developed by Gary Gygax after he was ousted from
>> TSR in the mid-80s used what he termed d10x, which was d10*d10,
>> resulting in values from 1 - 100 with a radically different
>> probability curve than a normal d100.

Not only a different curve, but also some values would be impossible
to get (as 13 and 51)

Na, if you get a 1 on the tens die and a 3 on the ones die, you have
rolled a 13.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

That doesn't jive with what was said earlier. There should be no zero
on the tens dice. Only 1..10.

Jim

ยทยทยท

On Jan 6, 2006, at 5:41 PM, James Edward Gray II wrote:

On Jan 6, 2006, at 5:35 PM, Jim Freeze wrote:

What do you need to roll to get a 0 and 100?

A zero on the tens dice is 10. On the one's dice, it's zero. 00 is 100.

Clarification: presented in short, long and practical. :slight_smile:

Short clarification:

Actually, when rolled together, both dice are zero-based. The
double-nought is the only special combination of 00 -> 100. When
rolled singly, a d10 has 0 -> 10. Rolling a 0 is never possible.

Long clarification:

Normally, a d% is rolled as a combination of a "d100" and a d10.
"d100" is in quotes, because it's actually just a special d10 -- 10
sided die, that is -- except the numbers on the "d100" are 00, 10,
20... 90. The numbers on the d10 are 0, 1, 2... 9. Rolling the two
together and adding you have a range from 0..99. However, since the
tables that require a d% roll are normally 1-based (1..100), the
'double-nought' -- a 00 on the "d100" and 0 on the d10 -- is
considered 100, everything else is face value. Some examples:

  00 / 5 -> 5
  10 / 5 -> 15
  20 / 0 -> 20
  00 / 0 -> 100

Similarly, when asked to roll a d10, the face numbers are 0..9, but
are interpreted as 1..10 by making the 0 a 10 and leaving the other
faces at face value.

All other dice (in my experience) are always interpreted as face value
(the sides being 1-based).

Regarding the probability curve of a d% versus a true d100 (100-sided
die), they are the same. Consider the d100: there are 100 faces, each
with a 1% probability. With a d% roll ("d100" + d10), each integer
between 1 and 100 (again, double-nought counting as 100) is produced
exactly once, and with the same probability. 53 (produced only by 50 +
3) is no more likely than 99 (90 + 9) or 1 (00 + 1). So for all
intents and purposes, a d% is equivalent to a d100.

Practical clarification:

As mentioned above, rolling two ten-sided dice versus rolling a
100-sided dice produce the same distribution (given the method of
combination). Rolling a ten-sided zero-based die then converting 0 to
10 versus rolling a ten-sided one-based die produce the same
distribution. So if you see dM then rand(M) + 1 will produce the
correct distribution. d% counts as d100.

Now if you'll excuse me, I'm late for an appointment with *my* dice.
Your die-rolling lesson for the day was brought to you by the numbers
3, 5 and the letter D. :slight_smile:

Jacob Fugal

ยทยทยท

On 1/6/06, James Edward Gray II <james@grayproductions.net> wrote:

On Jan 6, 2006, at 5:35 PM, Jim Freeze wrote:

> What do you need to roll to get a 0 and 100?

A zero on the tens dice is 10. On the one's dice, it's zero. 00 is
100.

Austin Ziegler a รฉcrit :

Austin Ziegler wrote:

No. d00/d%/d100 all refer to values from 1 to 100. It should be
considered impossible to get a value of 0 from dice. Strictly
speaking, d100 should be a special case simulated where you are
rolling two d10 values and treating one of them as the 10s and one of
them as the 1s. Again, it results in a slightly different curve than
a pure d100 result would be.

How exactly would those d10s differ from a d100?

In the same way that 3d6 is different than rand(16)+3. It's not
necessarily as dramatic a difference, but IME, the incidences of the
very lows (01-19) and very highs (81-00) are not as common as those in
the middle.

Not in that case ! Very simple : you have 100 possible values, ranging
from 1 to 100 ... each value correspond to a single dice configuration
(it you rool 2 and 5 you get 25 and you have no other way to get 25).
Thus the probability of each value is 1/100 ... and all values are
equiprobable !

And of course you can generalize the result ^^
You want a d1000 ? take 3 d10
You want a d36 ? take 2 d6 and calculate : 6*(d6-1) + d6
You want a d144 ? take 2 d12 : 12*(d12-1) + d12

ยทยทยท

On 06/01/06, Sascha Abel <sascha.abel@ewetel.name> wrote:

One gaming system developed by Gary Gygax after he was ousted from
TSR in the mid-80s used what he termed d10x, which was d10*d10,
resulting in values from 1 - 100 with a radically different
probability curve than a normal d100.

Not only a different curve, but also some values would be impossible
to get (as 13 and 51)

Yes.

-austin
--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Wow. That's some brilliant math.

1+3, of course, equals 4. No matter how many 1's are multiplied to result in 1. :stuck_out_tongue:

ยทยทยท

On Jan 7, 2006, at 9:55 AM, Gavin Kistner wrote:

Min: (5*1-4)*(1)+3 = 1*1+3 = 5