Re: Parsing a Dice Roll String
- Posted by "Christian Cuvier" <Christian.CUVIER at agriculture.gouv.fr> Aug 06, 2004
- 433 views
>>This is the issue. >>> First off, are things like "4d(3d6-Highest)" allowed (perform 4 times the >>> roll >>> described inside the inner parentheses)? > > > That formula wouldn't perform what's inside the parens four times. > Instead, it would create the number of faces using the formula inside > the parens, then roll 4 dice with that number of faces. > > So, for instance, 2d(3d4) would roll two dice whose sides equalled > from 3 up to 12. > I see. And I will assume you don't need it... > If you want to repeat a roll action, use something like > > 4:3d4 > > Which would now roll 3d4 four times and provide each result. > > In the simple version, we can ignore these types. In the advanced > version, sure, why not? The only reason I can see for doing that > would be statistical analysis. It wouldn't be very applicable. > Not necessarily. Assume you want to simulate some help from Luck. Then you repeat a roll of any complexity, andtake the best outcome of the "possible futures". The : operator will be easy to implement. > >>> Second, "would 4d6-Highest-Highest" be legal? >>> If so, would it mean "4d9-2*Highest" or "4d6 and remove the two highest >>> outcomes, adding up the rest"? > > > Right, but remember that > > 4d9-2*Highest > > is not the same as > > 4d9-1stHighest-2ndHighest > > >>> Should we parse '6d6-H3" (remove third highest individual outcome)? >>> Then, wht about "6d6-3L" (remove the three lowest individual oitcomes)? > > > Yeah, sure! (Again, maybe for the advanced version. ) > Again, not a real issue. For instance, "8d6-2*3H2" will create a sequence of 8 rand(6), add this up, get the slice [8-1-(3-1)..8-1] from the above, add it up and double, to finally substract this from the first one. The real problem would be "(4+3*2)d6", and I'd rather leave this one for the advanced version. I don't care what you put inside parentheses as long as it's not nested parentheses, because here the headaches start. > >>> I may start coding this WE if I get all questions answered before Friday >>> 17:00UTC. And, you know the kind of nasty questions that can arise when one >>> starts coding :D > > > Well, get at it! And send me questions when ya got 'em. > I'll tell you. I didn't consider the issues involved with writing to list_Rolls, perhaps there's none. > -=ck CChris