| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><no title> — xdice 1.0.0 documentation</title>
- <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: './',
- VERSION: '1.0.0',
- COLLAPSE_INDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true,
- SOURCELINK_SUFFIX: '.txt'
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
-
- <link rel="stylesheet" href="_static/custom.css" type="text/css" />
-
-
- <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
- </head>
- <body>
-
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body" role="main">
-
- <p># Dice Notation</p>
- <p><em>Dice notation</em> is nearly fully understood by pydice.</p>
- <p>## Dice</p>
- <p>> Following patterns can be passed to the Dice.parse() class method, and will then return the corresponding Dice object.</p>
- <p><strong>[See Wikipedia for a complete definition.](https://en.wikipedia.org/wiki/Dice_notation)</strong></p>
- <p>#### Bases</p>
- <p>Die rolls are given in the form AdX. A (amount) and X (sides) are variables, separated by the letter “d”, which stands for die or dice.</p>
- <ul class="simple">
- <li>A is the number of dice to be rolled (1 if omitted).</li>
- <li>X is the number of faces of each die.</li>
- </ul>
- <p>If the final number is omitted, it is assumed to be a twenty. (This can be changed trough the class property Dice.DEFAULT_SIDES)</p>
- <p>> For example, if a game would call for a roll of d4 or 1d4 this would mean, “roll one 4-sided die.”
- > <cite>3d6</cite> would mean, “roll three six-sided dice”</p>
- <p>Note: the <cite>D%</cite> notation is read as <cite>D100</cite></p>
- <p>#### Selective results</p>
- <p>This pattern can be followed by <cite>Ln</cite> and/or <cite>Hn</cite> expressions.
- ‘L’ and ‘H’ respectively stand for lowest and highest.</p>
- <p>In this case, the lowest/highest n scores will be discard when the dice will be rolled.</p>
- <p>> <cite>3D6L1</cite> will roll three 6-sided dice, and drop the lowest, while <cite>3D6H1</cite> will roll three 6-sided dice, and drop the highest.</p>
- <p>If no number follow the ‘L’ or ‘H’, it is assumed to be a 1.
- ‘L’ and ‘H’ can be combined inside a single pattern.</p>
- <p>## Patterns</p>
- <p>> Following patterns can be passed to the Pattern.parse() class method.</p>
- <p>#### Bases</p>
- <p><cite>AdX</cite> notations can be integrated in complex expressions.</p>
- <p>Any mathematical expression is allowed:</p>
- <blockquote>
- <div>>> 1d10+1d5+1
- >> 1d20-6
- >> 1d6*2
- >> 2d20//4
- >> 1d6*(1d4**2)</div></blockquote>
- <p>#### Builtin python functions</p>
- <p>Currently, the following python functions are allowed: <cite>abs</cite>, <cite>max</cite>, <cite>min</cite></p>
- <p>#### Repeat pattern</p>
- <p>The <cite>Rn(AdX)</cite> notation can be used to repat n times the <cite>AdX</cite> command.</p>
- <p>For example, the pattern <cite>R3(2d6+2)</cite> will roll <cite>2d6+2</cite> three times.</p>
- <p>## Examples</p>
- <p><cite>1d6</cite> > Roll a 6-sided die
- <cite>1d6+3</cite> > Roll a 6-sided die, then add 3
- <cite>2*(1d6+3)</cite> > Roll a 6-sided die, add 3, then multiply by 2
- <cite>3d6L2</cite> > Roll three 6-sided dice, and drop the two lowest.
- <cite>R2(1d6+3)</cite> > Similar to <cite>1d6+3+1d6+3</cite>
- <cite>1d%</cite> > Similar to <cite>1d100</cite>
- <cite>d6</cite> > Similar to <cite>1d6</cite>
- <cite>min(1d6+10,3d6)</cite> > Keep the minimal score between <cite>1d6+10</cite> and <cite>3d6</cite></p>
- </div>
- </div>
- </div>
- <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
- <div class="sphinxsidebarwrapper">
- <h1 class="logo"><a href="index.html">xdice</a></h1>
- <h3>Navigation</h3>
- <div class="relations">
- <h3>Related Topics</h3>
- <ul>
- <li><a href="index.html">Documentation overview</a><ul>
- </ul></li>
- </ul>
- </div>
- <div id="searchbox" style="display: none" role="search">
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <div><input type="text" name="q" /></div>
- <div><input type="submit" value="Go" /></div>
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="footer">
- ©2017, Olivier Massot.
-
- |
- Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.3</a>
- & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
-
- |
- <a href="_sources/dice_notation.md.txt"
- rel="nofollow">Page source</a>
- </div>
-
-
- </body>
- </html>
|