From: Ross Bamford Date: 2006-01-07T23:13:01+09:00 Subject: Re: [QUIZ] Dice Roller (#61) On Sat, 07 Jan 2006 13:51:51 -0000, Christian Neukirchen wrote: > "Ross Bamford" writes: > >> On Sat, 07 Jan 2006 12:27:05 -0000, Christian Neukirchen >> wrote: >> >>> "Ross Bamford" writes: >>> >>>> Hi, >>>> >>>> Just to make sure I have the precedence and so on right, I used a >>>> loaded dice that always rolls it's number of sides to write some >>>> tests. Since there's been some discussion over the precedence rules, >>>> I'll post them to maybe compare with others and see if I'm on the >>>> right track. Hope that's within the rules? I've left out broken input >>>> ones, since at the moment mine just 'does it's best' but I might >>>> tighten that up yet... >>>> >>>> @asserts = { >>> .. >>>> '(5d5-4)d(16/d4)+3' => 87, #25d4 + 3 >>>> } >>> >>> This is wrong, the maximum is 339: (25-4)d(16/1)+3. >>> >> >> I don't understand that. I get: >> >> (5d5-4)d(16/d4)+3 = 87 >> (5d5-4)d(16/d1)+3 = 339 >> >> I read the first as 21 rolls (25 - 4) of a four sided (16 / 4) dice >> plus 3, while the second is 21 rolls (25 - 4) of a 16 sided (16 / 1) >> 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. -- Ross Bamford - rosco@roscopeco.remove.co.uk