On Thu, Jan 21, 1999 at 02:31:10PM -0500, Stevie Strickland wrote: > > Just wondering, what's the output like and does it return for d10 0-9 or > > 1-10? Does it handle "d%"? Is the number of dice optional or must one > > feed it "1d8" for example? Does it return the results of each die or the > > total rolled or both? Can you give it something like "2d8 d12 3d6" and > > get a nice formatted output? Am I asking too many questions? => > > Eeeeeek! Let me see if I can answer your questions in order...
;> > Returns 1-10 (I add 1 to num_sides * (rand() / (RAND_MAX + 1.0)) :) > Handles d%? Oh, just put in d100 for right now, but I'll add that in :) > Number of dice right now is not optional, but could easily be fixed to > default to one... :) Cool => > Just total, decided that was the important part (if you ask for 3d6, > you're only interested in the result, unless you're doing something > like method IV of rolling characters in AD&D (I believe), in which you > roll 4d6 and take the highest three, in which case do 4x1d6 :) > > No, only handles the first string, I think... let me try it: > midkemia:~$ rolldice 2d8 1d12 3d6 > 13 In that case, may I suggest output like (goes digging to unbury his dice): $ rolldice 2d8 d12 3d6 2d8: 5 6 (11) d12: 2 3d6: 6 4 2 (12) You could optionally have a line giving a total if more than one set of dice are rolled, in this case something like: Total: 25 Or if you're really crazy, you could allow optional + or - to affect the total, if that were -d12 above the total would be 21 for example.. If it doesn't do EVERYTHING by that point, what more can be said? => > Nope, only first string, but I could just have it loop through the > non-option arguments, as well :) I'll go away before I scare you off from writing a dice roller, much less anything more important.. => > For your final question... no, I'm always glad to answer them, especially > since they usually give me things to think about as to new features :) Well I'm sure you have that by now.. => -- "I'm working in the dark here." "Yeah well rumor has it you do your best work in the dark." -- Earth: Final Conflict