R
Ross Bamford
Time to release your inner nerd.
The task for this Ruby Quiz is to write a dice roller.
Well, I'm no D&Der, but I think I'm gonna hand in my solution for this one
as my first Ruby Quiz entry
Cheers,
Time to release your inner nerd.
The task for this Ruby Quiz is to write a dice roller.
Ok, I'm still a little confused. This should have output something like:The task for this Ruby Quiz is to write a dice roller. You should
write a
program that takes two arguments: a dice expression followed by the
number of
times to roll it (being optional, with a default of 1). So to
calculate those
stats for your AD&D character, you would do this:
> roll.rb "3d6" 6
72 64 113 33 78 82
Or, for something more complicated:
> roll.rb "(5d5-4)d(16/d4)+3"
31
A few more things... Feel free to either craft this by hand or an
available
lexing/parsing library. Handling whitespace between integers and
operators is
nice. Some game systems use d100 quite often, and may abbreviate
it as "d%"
(but note that '%' is only allowed immediately after a 'd').
assuming it matters since I don't know what this stuff does.
Ok, I'm still a little confused. This should have output something
like:
rand(16)+3 rand(16)+3 rand(16)+3
What is the -4 and the /d4 do?
Does the +3 apply to (5d5-4)d(16/d4) or to (16/d4) only, assuming it
matters since I don't know what this stuff does.
So d100 =3D=3D d% =3D=3D d00
Yes.
100 =3D=3D 00
Huhu.Ruby said:The three rules of Ruby Quiz:
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
As (5d6)d7 or 5d(6d7) since there is no "Assoziativgesetz" like (AdB)dC
=3D=3D Ad(BdC).
Austin said:No. d00/d%/d100 all refer to values from 1 to 100. It should be
considered impossible to get a value of 0 from dice. Strictly speaking,
d100 should be a special case simulated where you are rolling two d10
values and treating one of them as the 10s and one of them as the 1s.
Again, it results in a slightly different curve than a pure d100 result
would be.
from TSR in the mid-80s used what he termed d10x, which was d10*d10,
resulting in values from 1 - 100 with a radically different probability
curve than a normal d100.
< One gaming system developed by Gary Gygax after he was ousted
Not only a different curve, but also some values would be
impossible to
get (as 13 and 51)
How exactly would those d10s differ from a d100?
Not only a different curve, but also some values would be impossible
to get (as 13 and 51)
All binary operators are left associative, so 5d6d7 is (5d6)d7.
Na, if you get a 1 on the tens die and a 3 on the ones die, you
have rolled a 13.
Or, for something more complicated:
> roll.rb "(5d5-4)d(16/d4)+3"
31
Na, if you get a 1 on the tens die and a 3 on the ones die, you have
rolled a 13.
No. d00/d%/d100 all refer to values from 1 to 100. It should be
considered impossible to get a value of 0 from dice. Strictly
speaking,
d100 should be a special case simulated where you are rolling two d10
values and treating one of them as the 10s and one of them as the 1s.
Again, it results in a slightly different curve than a pure d100
result
would be. One gaming system developed by Gary Gygax after he was
ousted
from TSR in the mid-80s used what he termed d10x, which was d10*d10,
resulting in values from 1 - 100 with a radically different
probability
curve than a normal d100.
What do you need to roll to get a 0 and 100?
That doesn't jive with what was said earlier. There should be no zeroA zero on the tens dice is 10. On the one's dice, it's zero. 00
is 100.
A zero on the tens dice is 10. On the one's dice, it's zero. 00 is
100.
Clarification: presented in short, long and practical.
Short clarification:
Actually, when rolled together, both dice are zero-based. The
double-nought is the only special combination of 00 -> 100. When
rolled singly, a d10 has 0 -> 10. Rolling a 0 is never possible.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.