Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Eiffel > Re: Proper way
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 881 of 917
Post > Topic >>

Re: Proper way

by iso8859-1@[EMAIL PROTECTED] Sep 2, 2007 at 11:00 PM

> The usual way is for roll to set an attribute (say last_roll: INTEGER)
> to the value produced. Then you call `roll' and follow by accessing the
> value of `last_roll'.
I did something similar to that. I created roll(count, side, offset :
Integer)
and created routines to get the data of the last roll (result, count,
side and offset).
>
> Note that I wouldn't make `side' an argument of `roll'. rather I would
> make it an attribute of the class. You set it in the creation
> procedure, and have a different object for a 6-sided die, and a
> 20-sided die.
What's the benefit of that?
>
> Although I wouldn't really want to transfer the 3d6, 1d100 examples
> directly from an rpg to my program. Instead I would go for the
> abstract of a random number distribution, and sample that directly
> (you might name the distribution objects with names such as 3d6
> though, within an rpg).
That would be too much work since I want the GM/Player to be able to
roll any dice-combination needed for the rpg played with the help of
this tool. This incudes parsing Strings of the type 3d6+12 to create
the proper output. Transfering that in the tool into the correct
distribution is far complexer to programm as parsing the string,
rolling the die-object 3 times, interpreting the result as 6 sided die
and adding all together including the 12.




 3 Posts in Topic:
Proper way
iso8859-1@[EMAIL PROTECTE  2007-08-29 13:01:39 
Re: Proper way
Colin Paul Adams <coli  2007-08-31 12:08:07 
Re: Proper way
iso8859-1@[EMAIL PROTECTE  2007-09-02 23:00:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 3:44:38 CDT 2008.