Robert R. schrieb:

Right?

(5d5-4)d(16/d4)+3

(5d5-4) is 25 at max

(16/d4) is 16 at max

25d16+3 is 339 at maxqed

Ignore me for lifetime please.

Robert R. schrieb:

Right?

(5d5-4)d(16/d4)+3

(5d5-4) is 25 at max

(16/d4) is 16 at max

25d16+3 is 339 at maxqed

Ignore me for lifetime please.

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

`___ - ___ ___ / ___ | | | |`

___ d ___ 4 16 ___ d ___

5 5 1 4So what are the maximum and minimum values of this?

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

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

The max for ndm is n*m.

On Sat, 07 Jan 2006 13:51:51 -0000, Christian N.

[email protected] wrote:

loaded dice that always rolls it’s number of sides to write some

dice, plus 3.

Right?

Yeah. I got your list wrong then, I thought the number means the

maximum reachable, not what to throw with loaded dice. Sorry.

Oh, I see. I guess it’s a standard thing to do to find the maximum? As I

say I’m a rank amateur when it comes to dice so I apologise if I’ve gone

against the normal way to do things.

I just wanted to be able to predict the result of the expressions, so I

could calculate the expected result to test the operator precedence

rules.

With the loaded dice, 5d5 is effectively a (higher-precedence) 5*5. Hope

it doesn’t cause confusion.

In article [email protected],

Christian N. [email protected] wrote:

`___ - ___ ___ / ___ | | | |`

___ d ___ 4 16 ___ d ___

5 5 1 4So 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

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

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

“Matthew D Moss” [email protected] writes:

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

So what are the maximum and minimum values of this?

Max: (5

5+4)(16/4)+3 = 29*4+3 = 119

Man, *and* I flipped the sign on that -4. *shakes head sadly*

One more shot.

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

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

Min: (5

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

Wow. That’s some brilliant math.

1+3, of course, equals 4. No matter how many 1’s are multiplied to

result in 1.

On Jan 7, 2006, at 9:58 AM, Reinder V. wrote:

([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,bd] if a,b,c, and d

I’m agree with you on that top line, but I’m not sure how you got to

the second line from there.

I think you meant:

([1,21])d([1,4])+3 = …

which results in:

[1,84]+3

[4,87]

From: “Gavin K.” [email protected]

Min: (5

1-4)(1)+3 = 11+3 = 45-4)

Max: (5(16/4)+3 = 214+3 = 87

For max, should be (16/1) not (16/4), no?

Gavin K. [email protected] writes:

One more shot.

Min: (5

1-4)(1)+3 = 11+3 = 45-4)

Max: (5(16/4)+3 = 214+3 = 87

I claim 4 and 339.

Gavin K. wrote:

On Jan 7, 2006, at 9:58 AM, Reinder V. wrote:

([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,bd] if a,b,c, and d

I’m agree with you on that top line, but I’m not sure how you got to

the second line from there.

I think you meant:([1,21])d([1,4])+3 = …

which results in:

[1,84]+3

[4,87]

d(16/[1,4]) must be [16/4,16/1] => [4,16]

[1,21] d [4,16] must be [1*4, 16*21] => [4, 336]

I would like to introduce distribution. Using one normal dice we have an

even distribution

distr(“d6”) = [0,1,1,1,1,1,1] Sum=6

Using two normal dices we have the following distribution

distr(“2d6”)=[0,0,1,2,3,4,5,6,5,4,3,2,1] Sum=36 (min:max) =

(2:12)

P(“2d6”,12) = 1/36 = 2.8%

I have a question regarding the distribution for “(d2)d6”.

In words, I’m first throwing a coin, to decide how many times I will

throw a the dice.

[1,2] d [1,2,3,4,5,6]

My guess:

distr(“d6”) = [0,1,1,1,1,1,1] Sum=6

distr(“2d6”) = [0,0,1,2,3,4,5,6,5,4,3,2,1] Sum=36

Probability merge

distr(“d6”) [0,6,6,6,6, 6, 6] Sum=36

distr(“2d6”) [0,0,1,2,3, 4, 5,6,5,4,3,2,1] Sum=36

distr("(d2)d6") [0,6,7,8,9,10,11,6,5,4,3,2,1] Sum=72

The probability of having one point is P("(d2)d6",1) = 6/72 = 8.3%

Can somebody agree or disagree on this?

Christer

On Jan 7, 2006, at 18:32, Christian N. wrote:

Man,

andI flipped the sign on that -4.shakes head sadlyOne more shot.

Min: (5

1-4)(1)+3 = 11+3 = 45-4)

Max: (5(16/4)+3 = 214+3 = 87I claim 4 and 339.

Both (4, 87) and (4, 339) are correct depending on your definition of

‘max’. You get the former if you assume maximum rolls for each die,

and the latter if you want the maximum possible result of the

expression.

In any case, the extremal results aren’t particularly useful from a

testing point of view, as different distributions can have the same

extremal points, and you could potentially erroneously pass an

incorrect case. For example: 2d2d6

left-associative:

(2d2)d6 -> 4d6 -> 24 max

right-associative (oops!):

2d(2d6) -> 2d12 -> 24 max

But the distributions are different in each case (the latter result

could include 2 and 3, for instance).

matthew smillie.

On Jan 7, 2006, at 11:36 AM, Bill K. wrote:

From: “Gavin K.” [email protected]

Min: (5

1-4)(1)+3 = 11+3 = 45-4)

Max: (5(16/4)+3 = 214+3 = 87For max, should be (16/1) not (16/4), no?

You’re all too damned smart.

Brilliant!

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:

- Use the expanded BNF I posted, which doesn’t have this fault.
- 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.

With the game systems I know, and I admit I haven’t played for a couple

of years, 5d6d7 would not be a legal expression, and would raise an

exception.

Ahhh… this must be a game system you don’t know. =)

On 1/7/06, Christer N. [email protected] wrote:

distr(“2d6”) = [0,0,1,2,3,4,5,6,5,4,3,2,1] Sum=36

Probability merge

distr(“d6”) [0,6,6,6,6, 6, 6] Sum=36

distr(“2d6”) [0,0,1,2,3, 4, 5,6,5,4,3,2,1] Sum=36distr("(d2)d6") [0,6,7,8,9,10,11,6,5,4,3,2,1] Sum=72

The probability of having one point is P("(d2)d6",1) = 6/72 = 8.3%

Can somebody agree or disagree on this?

Off the top of my head, that seems right.

Matthew M. a écrit :

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

…

Pierre

Austin Z. 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.

Pierre Barbier de Reuille schrieb:

error, in that it allows expressions like this:

and it is perfectly valid as there is no other way to understand that …

Pierre

Hmm so that expr has 18 as maximum result with fully loaded dice?

3d(d(d(d6)))

3d(d(d6))

3d(d6)

3d6

=> 18

Is that correct?

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

wrote:

} Matthew M. 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.

} Pierre

–Greg

Attached is my submission. It looks pretty cool to me, but then this is

only my second-ever Ruby program.

Meta-comment: if [QUIZ] opens the quiz, then surely [/QUIZ] should close

it.

Luke B.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs