From subsequent discussion, it turns out that you
do want to treat "List" as a number. In this case, "List" is the wrong name. You actually want to call it "Roll". Then, a "Roll"
has-a "Dieroll". The "Dieroll" is the physical rolling of the die. A Roll would have a list of Dierolls that would demonstrate what physically happened with the dice
*. Then, you would use
overload to allow you to treat Roll as a number.
As for the perlboot stuff, you misunderstood. You need to name it so that the casual reader of your code understands exactly what an object of this class will be used for, within the context of your program. If your code is about AD&D, I expect to see a "Roll" class. If it's called "List", I don't know what it's a list of.
*: For those confused, there are certain situations where you actually need to know which dice rolled which values. For example, certain immunities state "Reduce the value of each die rolled by 1 with a minimum of 1." This means that a 1 is still a 1, but a 2 is also a 1. But, this is only for that character. So, in the case of one person in a group having an immunity to fire and the group being subjected to a fireball, each person's damage is applied separately once the damage for the fireball is calculated. (In some rulesets, the damage for the fireball is calculated separately for each person, complicating matters further.)
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.