Programmer

Programmer Home

Getting Started

Success


Die Rolling Program

Reality Fault

Home

Player

Character

Referee

Programmer

Administrator

Operations


Search RealityFault:

General Info

Glossary

Realms

Events

Credits

Help Files

Help Files (old)


Reality Fault

Die Rolling Program

Proposal

We would like to provide a "die rolling" program for Reality Fault that has a number of features:
  • Algebraic-style operation and precedence
  • Multiple die rolls on a single command line
  • Gameing-specific die types, tests, and results
  • Easy, per-environment configuration
  • Easy customization of operators, precedence, and die-types

The components of this program should be organized in a fashion that makes it easy to reuse those components in other programs.

Program

  1. Check input for conditions that provide guidance for the major mode of operation, i.e. roll dice, configure environment, report configuration, etc.
  2. Check the input for obvious, "non-action" requests:
    #help, #version, bad flags, etc.
  3. For each argument:
    1. Make sure each is a valid dSPEC
    2. Execute the dSPEC
    3. Format the result
    4. Report the result to the correct people

Q: Should each dSPEC be checked for validity before any are executed?

Q: Are any results reported before each dSPEC is validated?

Q: When/where should conflicting die-operators be detected, and what should be done if conflicting die-operators are present in the same dSPEC?

Operator Library

Implied
( )
Not actually operators, per se, these tokens are used to over-ride precedence. Frex:
3+2*4=11. (3+2)*4=20
Standard Math
+ - / * %
The only one of these that may not be 100% familiarly to one and all is the modulo operator. This returns the remainder of a division operation. Frex:
10%3="three with one left over"=1
Boolean?
< > =
These tokens are used to compare the values. Frex, 1<2 returns 1, 1>2 returns 0, 1=0 returns "What were you thinking?!?"
Randomizers
d a s f
XdY
Return the sum of X numbers, each from 1 to Y (default 1d6)
XaY
Return the sum of X numbers, skewed toward the "average" on the die range from:
A=average(1+Y)
(1+A)/2 to (Y+A)/2

(Are we worried about rounding in any of this? Solving this for d6 gives a flat range from 2.25 to 4.75.)

This formula preserves the average, and eliminates the possiblity of rolls at either end of the nominal range. -- For a d6 (1-6, avg=3.5) the range becomes (2-5, avg=3.5).

I will point out that the formula we are using does not exactly simulate the d6 "averaging die" we were using as an example. In our formula, each of the numbers from 2-5 occurs equally often. On the averaging die, a 3 or 4 occurs twice as often as a 2 or 5. I don't think this is important for our needs, but it is something to be aware of.

XsY
Returns a list of X numbers, each from 1 to Y (default 1d6) This default isn't really useful as a sequence, is it? Unless someone can suggest a useful default sequence, I'm not inclined to change it, though.
Control
Mostly we were thinking these operator would be used with the Boolean operators for rolling "Storyteller" type successes. Frex, trying to roll 5d10, examining each to see if it is greater than or equal to a target number of 7, and reporting the number of rolls that met the criteria might be 5x[d10>7]
[ ]
[dSPEC]
Used to specify a dSPEC as an argument to another operator. Frex, 2d3d would be "Roll 2d3. Roll that many d6 and read the total." 2d[3d] would be "roll 3d6. Roll 2 dice of that many sides."
2d[3d] -> 2d[10] -> 2d10 -> 11
10d[4d3] -> 10d[8] -> 10d8 -> 45
x
XxY
Returns X rolls of a die of Y sides. Frex, 3x6 would expand to: (1d6 1d6 1d6), which is no different than 3d6. Again, the non-useful default would be 1x6. Q: What would 3x6+1 return? 1d6+1 three times? (Hm. No.) (1d6 1d6 1d6+1) Maybe. (1d6 1d6 1d6 +1) Probably.

Does this operator essentially expand an expression into a dSPEC, determine the results and then the total?

5x[d10>7] ->
d10>7 d10>7 d10>7 d10>7 d10>7 ->
5>7 4>7 6>7 3>7 7>7 ->
0 0 0 0 1 ->
1

This would mean that 5x[d10>7]+1 (given the same rolls) would be 2. So, 3x6+1 ->

[d6 d6 d6]+1
[3 4 5]+1
[12]+1
13
Other things the library should be good for These arguments can be part of a list of dSPEC arguments #v, #!v turn on/off verbose reporting. #q, #!q turn on/off quiet reporting #t, #!t turn on/off testing ??? read/write configuration information ??? validate dSPEC ??? display results (a default reporting function) ??? execute? (the basic "please turn this dSPEC into a result")

Wrapper Library

n k i

Communications Library

Send output to various users, in various formats. (lib-argo?)

Command Line Processing

LSEDIT "Array" Library

Outstanding Issues

roll 5k+1 roll program parses, hands to HSR wrapper Wrapper: decided that 5 DC = 1.5d6 rolls 1d6+1d3, gets BODY rolls 1d6-1+1, gets STUN MULTIPLE gets STUN reports... what? "TOTAL_STUN TOTAL_BODY" "BODY_ON_D6 BODY_ON_D3 MULT"

Rolling "Target Numbers" Samples

The GM says: Roll 5d versus a target of 7 Using only simplest operators roll d10 d10 d10 d10 d10 Examine results. Any result of 7+ is a success. Using "Boolean" operators roll d10<(7-1)+d10<(7-1)+d10<(7-1)+d10<(7-1)+d10<(7-1) roll d10<6+d10<6+d10<6+d10<6+d10<6 Reported results are the number of successes. Using a "Repeat" operator roll 5x(d10<(7-1)) roll 5x(d10<6) Reported results are the number of successes. Using a "Storyteller" wrapper roll 5d vs 7 roll 5 vs 7 roll 5v7 roll 5v <- Wrapper defined default of 7 Using a "Property Parsing" roller roll Celerity




Last modified: 2002-Aug-11 13:27:32

All material on this site is
Copyright © 2002-2024 Reality Fault
unless specifically indicated on each document.
All Rights Reserved.
Administrated by Reality Fault Webmaster