index.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>&lt;no title&gt; &#8212; xdice 1.0.0 documentation</title>
  7. <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: './',
  12. VERSION: '1.0.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true,
  16. SOURCELINK_SUFFIX: '.txt'
  17. };
  18. </script>
  19. <script type="text/javascript" src="_static/jquery.js"></script>
  20. <script type="text/javascript" src="_static/underscore.js"></script>
  21. <script type="text/javascript" src="_static/doctools.js"></script>
  22. <link rel="index" title="Index" href="genindex.html" />
  23. <link rel="search" title="Search" href="search.html" />
  24. <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  25. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
  26. </head>
  27. <body>
  28. <div class="document">
  29. <div class="documentwrapper">
  30. <div class="bodywrapper">
  31. <div class="body" role="main">
  32. <p># XDice</p>
  33. <p><em>xdice</em> is a lightweight python library for managing dice, scores, and dice-notation patterns.</p>
  34. <p>It allows to easily interpret literal expressions as rolls of dice (‘1d6’, ‘3d4+3’, ‘12d6+1d4’…etc.), then manipulate the results.</p>
  35. <p>### Python Versions</p>
  36. <p>DiceRollParser has been tested with python 3.3+</p>
  37. <p>### Examples</p>
  38. <blockquote>
  39. <div><p>import dice</p>
  40. <p>## Roll simple dices with <strong>rolldice()</strong></p>
  41. <p>score = rolldice(6, amount=2)</p>
  42. <p># manipulates score as an integer</p>
  43. <p>print( score, score * 2, score == 11 )
  44. &gt;&gt; 11 22 True</p>
  45. <p># Iterates over the results</p>
  46. <dl class="docutils">
  47. <dt>for result in score:</dt>
  48. <dd>print(result)</dd>
  49. </dl>
  50. <p>&gt;&gt; 5
  51. &gt;&gt; 6</p>
  52. <p># Parse patterns with <strong>roll()</strong></p>
  53. <p>ps = roll(“2d6+18”)</p>
  54. <p>print( ps, ps.format() )
  55. &gt;&gt; 28 ‘[5,6]+18’</p>
  56. </div></blockquote>
  57. <p>### Contribution</p>
  58. <p>Any opinion / contribution is welcome, please contact us.</p>
  59. <p>### Installation</p>
  60. <blockquote>
  61. <div>pip install xdice</div></blockquote>
  62. <p>### License</p>
  63. <p><em>xdice</em> is under GNU License</p>
  64. <p>### Tags</p>
  65. <blockquote>
  66. <div>dice roll d20 game random parser dices role board</div></blockquote>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  71. <div class="sphinxsidebarwrapper">
  72. <h1 class="logo"><a href="#">xdice</a></h1>
  73. <h3>Navigation</h3>
  74. <div class="relations">
  75. <h3>Related Topics</h3>
  76. <ul>
  77. <li><a href="#">Documentation overview</a><ul>
  78. </ul></li>
  79. </ul>
  80. </div>
  81. <div id="searchbox" style="display: none" role="search">
  82. <h3>Quick search</h3>
  83. <form class="search" action="search.html" method="get">
  84. <div><input type="text" name="q" /></div>
  85. <div><input type="submit" value="Go" /></div>
  86. <input type="hidden" name="check_keywords" value="yes" />
  87. <input type="hidden" name="area" value="default" />
  88. </form>
  89. </div>
  90. <script type="text/javascript">$('#searchbox').show(0);</script>
  91. </div>
  92. </div>
  93. <div class="clearer"></div>
  94. </div>
  95. <div class="footer">
  96. &copy;2017, Olivier Massot.
  97. |
  98. Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.3</a>
  99. &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
  100. |
  101. <a href="_sources/index.md.txt"
  102. rel="nofollow">Page source</a>
  103. </div>
  104. </body>
  105. </html>