-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14ed89c
commit 82eba8d
Showing
18 changed files
with
330 additions
and
19 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
**Installing diceroll** | ||
======================= | ||
Installing *diceroll 2.2* is as easy as always. Just copy ``diceroll.py`` into the same folder | ||
your code happens to be in. | ||
|
||
Then add this line at (or near) the top of your code: :: | ||
|
||
from diceroll import roll | ||
|
||
If your code setup is different, in that you like to keep your function modules in a folder separate | ||
from your main code, you could copy ``diceroll.py`` into that folder. | ||
|
||
Say you have a folder called ``library``, and assuming you have an ``__init__.py`` inside it, just copy ``diceroll.py`` | ||
into your ``library`` folder and add this line near the top of your code :: | ||
|
||
from library.diceroll import roll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,60 @@ | ||
**diceroll Tutorial** | ||
===================== | ||
.. versionadded:: 2.2 | ||
Once ``diceroll.py`` is installed and recognized by your code, its ``roll()`` function can be used right away. This | ||
function returns an integer, by the way. So it can be used as any other integer would be used. But first, | ||
we must give this function a value to work from. | ||
|
||
Those of you that have used dice rolling programs before will notice that something is different. And that is, | ||
``roll()`` uses a string for its input: | ||
|
||
>>> die1 = roll('1D6') | ||
>>> die2 = roll('1d6') | ||
>>> dice = '3D4+1' | ||
>>> print die1, die2, roll(dice) | ||
3, 2, 9 | ||
|
||
Not that the inputted string values can be upper or lower case. And note that the return values are integer. | ||
|
||
The dice types to roll are: | ||
D3, D4, D6, D8, D9, D10, D12, D20, D30, D100, D66, DD, FLUX, GOODFLUX, BADFLUX | ||
|
||
This is a short description about how to use diceroll: :: | ||
.. note:: | ||
You may recognize some of these dice types from various tabletop role-playing games. There is probably a | ||
standard notation for dice rolls used in games. But each game typically uses its own notation. | ||
|
||
| | ||
| *diceroll* uses a simple standard when it comes to the more plainer dice types. | ||
| | ||
| Some examples are: | ||
| | ||
| roll('D6') or roll('1D6') -- roll one 6-sided die | ||
| roll('2D6') -- roll two 6-sided dice | ||
| roll('D10') -- roll a 10-sided die (1 - 10) | ||
| roll('D100') -- roll a 100-sided die (1 - 100) | ||
| roll('D66') -- roll for a D66 chart | ||
| roll('FLUX') -- a FLUX roll (-5 to 5) | ||
| roll('3D6+6') -- add +6 DM to roll | ||
| roll('4D4-4') -- add -4 DM to roll | ||
| roll('2DD+3') -- roll (2D6+3) x 10 | ||
| roll('info') -- release version of program | ||
|
||
Entering an invalid string for ``roll()`` will return an error message, as well as a value of 0 from the function. :: | ||
|
||
from dicerull import roll | ||
print roll('3d') | ||
|
||
.. error:: | ||
** DICE ERROR! '3D' is unknown ** | ||
|
||
| | ||
| 0 | ||
|
||
One exception to the "integer" rule for ``roll()`` is when using ``roll('info')``, which will return two strings. | ||
|
||
.. versionadded:: 2.2 | ||
|
||
>>> version, release = roll('info') | ||
>>> print version | ||
2.2 | ||
>>> print release | ||
roll(), release version 2.2.1 (Beta) for Python 2.5.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!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>Installing diceroll — diceroll 2.2 Manual</title> | ||
<link rel="stylesheet" href="_static/default.css" type="text/css" /> | ||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" /> | ||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT: '', | ||
VERSION: '2.2.1b', | ||
COLLAPSE_MODINDEX: false, | ||
FILE_SUFFIX: '.html' | ||
}; | ||
</script> | ||
<script type="text/javascript" src="_static/jquery.js"></script> | ||
<script type="text/javascript" src="_static/doctools.js"></script> | ||
<link rel="shortcut icon" href="_static/diceroll_icon_16x16.ico"/> | ||
<link rel="contents" title="Global table of contents" href="contents.html" /> | ||
<link rel="index" title="Global index" href="genindex.html" /> | ||
<link rel="search" title="Search" href="search.html" /> | ||
<link rel="top" title="diceroll 2.2 Manual" href="index.html" /> | ||
<link rel="next" title="diceroll Tutorial" href="tutorial.html" /> | ||
<link rel="prev" title="Designer’s Notes" href="designers_notes.html" /> | ||
</head> | ||
<body> | ||
<div class="related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="genindex.html" title="General Index" | ||
accesskey="I">index</a></li> | ||
<li class="right" > | ||
<a href="modindex.html" title="Global Module Index" | ||
accesskey="M">modules</a> |</li> | ||
<li class="right" > | ||
<a href="tutorial.html" title="diceroll Tutorial" | ||
accesskey="N">next</a> |</li> | ||
<li class="right" > | ||
<a href="designers_notes.html" title="Designer’s Notes" | ||
accesskey="P">previous</a> |</li> | ||
<li><a href="index.html">diceroll 2.2 Manual</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
<div class="body"> | ||
|
||
|
||
<div class="section" id="installing-diceroll"> | ||
<h1><strong>Installing diceroll</strong><a class="headerlink" href="#installing-diceroll" title="Permalink to this headline">¶</a></h1> | ||
<p>Installing <em>diceroll 2.2</em> is as easy as always. Just copy <tt class="docutils literal"><span class="pre">diceroll.py</span></tt> into the same folder | ||
your code happens to be in.</p> | ||
<p>Then add this line at (or near) the top of your code:</p> | ||
<div class="highlight"><pre><span class="kn">from</span> <span class="nn">diceroll</span> <span class="kn">import</span> <span class="n">roll</span> | ||
</pre></div> | ||
<p>If your code setup is different, in that you like to keep your function modules in a folder separate | ||
from your main code, you could copy <tt class="docutils literal"><span class="pre">diceroll.py</span></tt> into that folder.</p> | ||
<p>Say you have a folder called <tt class="docutils literal"><span class="pre">library</span></tt>, and assuming you have an <tt class="docutils literal"><span class="pre">__init__.py</span></tt> inside it, just copy <tt class="docutils literal"><span class="pre">diceroll.py</span></tt> | ||
into your <tt class="docutils literal"><span class="pre">library</span></tt> folder and add this line near the top of your code</p> | ||
<div class="highlight"><pre><span class="kn">from</span> <span class="nn">library.diceroll</span> <span class="kn">import</span> <span class="n">roll</span> | ||
</pre></div> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
</div> | ||
<div class="sphinxsidebar"> | ||
<div class="sphinxsidebarwrapper"> | ||
<h4>Previous topic</h4> | ||
<p class="topless"><a href="designers_notes.html" title="previous chapter"><strong>Designer’s Notes</strong></a></p> | ||
<h4>Next topic</h4> | ||
<p class="topless"><a href="tutorial.html" title="next chapter"><strong>diceroll Tutorial</strong></a></p> | ||
<h3>This Page</h3> | ||
<ul class="this-page-menu"> | ||
<li><a href="_sources/installing.txt">Show Source</a></li> | ||
</ul> | ||
<h3>Quick search</h3> | ||
<form class="search" action="search.html" method="get"> | ||
<input type="text" name="q" size="18" /> <input type="submit" value="Go" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="genindex.html" title="General Index" | ||
accesskey="I">index</a></li> | ||
<li class="right" > | ||
<a href="modindex.html" title="Global Module Index" | ||
accesskey="M">modules</a> |</li> | ||
<li class="right" > | ||
<a href="tutorial.html" title="diceroll Tutorial" | ||
accesskey="N">next</a> |</li> | ||
<li class="right" > | ||
<a href="designers_notes.html" title="Designer’s Notes" | ||
accesskey="P">previous</a> |</li> | ||
<li><a href="index.html">diceroll 2.2 Manual</a> »</li> | ||
</ul> | ||
</div> | ||
<div class="footer"> | ||
© Copyright 2017, Shawn Driscoll. | ||
Last updated on Oct 01, 2017. | ||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.