Skip to content

Commit

Permalink
added tutorial page
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnDriscoll committed Oct 1, 2017
1 parent 14ed89c commit 82eba8d
Show file tree
Hide file tree
Showing 18 changed files with 330 additions and 19 deletions.
Binary file modified docs/build/.doctrees/diceroll.doctree
Binary file not shown.
Binary file modified docs/build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/.doctrees/index.doctree
Binary file not shown.
Binary file added docs/build/.doctrees/installing.doctree
Binary file not shown.
Binary file modified docs/build/.doctrees/tutorial.doctree
Binary file not shown.
5 changes: 4 additions & 1 deletion docs/build/_sources/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
**diceroll 2.2 Manual**
=======================

**A Python Dice Rolling Module** https://github.com/ShawnDriscoll/diceroll
**A Python Dice Rolling Module**

https://github.com/ShawnDriscoll/diceroll

Requirements
------------
Expand Down Expand Up @@ -32,6 +34,7 @@ Contents
:maxdepth: 2

designers_notes
installing
tutorial
diceroll

Expand Down
16 changes: 16 additions & 0 deletions docs/build/_sources/installing.txt
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
57 changes: 54 additions & 3 deletions docs/build/_sources/tutorial.txt
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

2 changes: 1 addition & 1 deletion docs/build/diceroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2017, Shawn Driscoll.
Last updated on Sep 30, 2017.
Last updated on Oct 01, 2017.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
6 changes: 5 additions & 1 deletion docs/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ <h3>Navigation</h3>
<img alt="_images/diceroll_cover.png" src="_images/diceroll_cover.png" />
<div class="section" id="diceroll-2-2-manual">
<h1><strong>diceroll 2.2 Manual</strong><a class="headerlink" href="#diceroll-2-2-manual" title="Permalink to this headline"></a></h1>
<p><strong>A Python Dice Rolling Module</strong> <a class="reference external" href="https://github.com/ShawnDriscoll/diceroll">https://github.com/ShawnDriscoll/diceroll</a></p>
<p><strong>A Python Dice Rolling Module</strong></p>
<p><a class="reference external" href="https://github.com/ShawnDriscoll/diceroll">https://github.com/ShawnDriscoll/diceroll</a></p>
<div class="section" id="requirements">
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline"></a></h2>
<ul>
Expand Down Expand Up @@ -87,6 +88,9 @@ <h2>Contents<a class="headerlink" href="#contents" title="Permalink to this head
</li>
</ul>
<ul>
<li><a class="reference external" href="installing.html"><strong>Installing diceroll</strong></a></li>
</ul>
<ul>
<li><a class="reference external" href="tutorial.html"><strong>diceroll Tutorial</strong></a></li>
</ul>
<ul>
Expand Down
114 changes: 114 additions & 0 deletions docs/build/installing.html
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 &mdash; 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&#8217;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&#8217;s Notes"
accesskey="P">previous</a> |</li>
<li><a href="index.html">diceroll 2.2 Manual</a> &raquo;</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&#8217;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&#8217;s Notes"
accesskey="P">previous</a> |</li>
<li><a href="index.html">diceroll 2.2 Manual</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2017, Shawn Driscoll.
Last updated on Oct 01, 2017.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/build/modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<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" />
<generator object at 0x03801990>
<generator object at 0x0366F8F0>

<script type="text/javascript">
DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX = true;
Expand Down
2 changes: 1 addition & 1 deletion docs/build/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<link rel="index" title="Global index" href="genindex.html" />
<link rel="search" title="Search" href="" />
<link rel="top" title="diceroll 2.2 Manual" href="index.html" />
<generator object at 0x03686EB8>
<generator object at 0x036E5120>
<script type="text/javascript" src="_static/searchtools.js"></script>

</head>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/searchindex.json

Large diffs are not rendered by default.

65 changes: 59 additions & 6 deletions docs/build/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link rel="search" title="Search" href="search.html" />
<link rel="top" title="diceroll 2.2 Manual" href="index.html" />
<link rel="next" title="diceroll Module" href="diceroll.html" />
<link rel="prev" title="Designer&#8217;s Notes" href="designers_notes.html" />
<link rel="prev" title="Installing diceroll" href="installing.html" />
</head>
<body>
<div class="related">
Expand All @@ -37,7 +37,7 @@ <h3>Navigation</h3>
<a href="diceroll.html" title="diceroll Module"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="designers_notes.html" title="Designer&#8217;s Notes"
<a href="installing.html" title="Installing diceroll"
accesskey="P">previous</a> |</li>
<li><a href="index.html">diceroll 2.2 Manual</a> &raquo;</li>
</ul>
Expand All @@ -50,10 +50,63 @@ <h3>Navigation</h3>

<div class="section" id="diceroll-tutorial">
<h1><strong>diceroll Tutorial</strong><a class="headerlink" href="#diceroll-tutorial" title="Permalink to this headline"></a></h1>
<p>Once <tt class="docutils literal"><span class="pre">diceroll.py</span></tt> is installed and recognized by your code, its <tt class="docutils literal"><span class="pre">roll()</span></tt> 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.</p>
<p>Those of you that have used dice rolling programs before will notice that something is different. And that is,
<tt class="docutils literal"><span class="pre">roll()</span></tt> uses a string for its input:</p>
<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">die1</span> <span class="o">=</span> <span class="n">roll</span><span class="p">(</span><span class="s">&#39;1D6&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">die2</span> <span class="o">=</span> <span class="n">roll</span><span class="p">(</span><span class="s">&#39;1d6&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dice</span> <span class="o">=</span> <span class="s">&#39;3D4+1&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">die1</span><span class="p">,</span> <span class="n">die2</span><span class="p">,</span> <span class="n">roll</span><span class="p">(</span><span class="n">dice</span><span class="p">)</span>
<span class="go">3, 2, 9</span>
</pre></div>
<p>Not that the inputted string values can be upper or lower case. And note that the return values are integer.</p>
<dl class="docutils">
<dt>The dice types to roll are:</dt>
<dd>D3, D4, D6, D8, D9, D10, D12, D20, D30, D100, D66, DD, FLUX, GOODFLUX, BADFLUX</dd>
</dl>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>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.</p>
<div class="last line-block">
<div class="line"><br /></div>
<div class="line"><em>diceroll</em> uses a simple standard when it comes to the more plainer dice types.</div>
<div class="line"><br /></div>
<div class="line">Some examples are:</div>
<div class="line"><br /></div>
<div class="line">roll(&#8216;D6&#8217;) or roll(&#8216;1D6&#8217;) &#8211; roll one 6-sided die</div>
<div class="line">roll(&#8216;2D6&#8217;) &#8211; roll two 6-sided dice</div>
<div class="line">roll(&#8216;D10&#8217;) &#8211; roll a 10-sided die (1 - 10)</div>
<div class="line">roll(&#8216;D100&#8217;) &#8211; roll a 100-sided die (1 - 100)</div>
<div class="line">roll(&#8216;D66&#8217;) &#8211; roll for a D66 chart</div>
<div class="line">roll(&#8216;FLUX&#8217;) &#8211; a FLUX roll (-5 to 5)</div>
<div class="line">roll(&#8216;3D6+6&#8217;) &#8211; add +6 DM to roll</div>
<div class="line">roll(&#8216;4D4-4&#8217;) &#8211; add -4 DM to roll</div>
<div class="line">roll(&#8216;2DD+3&#8217;) &#8211; roll (2D6+3) x 10</div>
<div class="line">roll(&#8216;info&#8217;) &#8211; release version of program</div>
</div>
</div>
<p>Entering an invalid string for <tt class="docutils literal"><span class="pre">roll()</span></tt> will return an error message, as well as a value of 0 from the function.</p>
<div class="highlight"><pre><span class="k">print</span> <span class="n">roll</span><span class="p">(</span><span class="s">&#39;3d&#39;</span><span class="p">)</span>
</pre></div>
<div class="admonition error">
<p class="first admonition-title">Error</p>
<p>** DICE ERROR! &#8216;3D&#8217; is unknown **</p>
<div class="last line-block">
<div class="line"><br /></div>
<div class="line">0</div>
</div>
</div>
<p>One exception to the &#8220;integer&#8221; rule for <tt class="docutils literal"><span class="pre">roll()</span></tt> is when using <tt class="docutils literal"><span class="pre">roll('info')</span></tt>, which will return two strings.</p>
<p>
<span class="versionmodified">New in version 2.2.</span></p>
<p>This is a short description about how to use diceroll:</p>
<div class="highlight"><pre><span class="kn">from</span> <span class="nn">dicerull</span> <span class="kn">import</span> <span class="n">roll</span>
<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">version</span><span class="p">,</span> <span class="n">release</span> <span class="o">=</span> <span class="n">roll</span><span class="p">(</span><span class="s">&#39;info&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">version</span>
<span class="go">2.2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">release</span>
<span class="go">roll(), release version 2.2.1 (Beta) for Python 2.5.4</span>
</pre></div>
</div>

Expand All @@ -64,7 +117,7 @@ <h1><strong>diceroll Tutorial</strong><a class="headerlink" href="#diceroll-tuto
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="designers_notes.html" title="previous chapter"><strong>Designer&#8217;s Notes</strong></a></p>
<p class="topless"><a href="installing.html" title="previous chapter"><strong>Installing diceroll</strong></a></p>
<h4>Next topic</h4>
<p class="topless"><a href="diceroll.html" title="next chapter"><strong>diceroll Module</strong></a></p>
<h3>This Page</h3>
Expand Down Expand Up @@ -94,7 +147,7 @@ <h3>Navigation</h3>
<a href="diceroll.html" title="diceroll Module"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="designers_notes.html" title="Designer&#8217;s Notes"
<a href="installing.html" title="Installing diceroll"
accesskey="P">previous</a> |</li>
<li><a href="index.html">diceroll 2.2 Manual</a> &raquo;</li>
</ul>
Expand Down
5 changes: 4 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
**diceroll 2.2 Manual**
=======================

**A Python Dice Rolling Module** https://github.com/ShawnDriscoll/diceroll
**A Python Dice Rolling Module**

https://github.com/ShawnDriscoll/diceroll

Requirements
------------
Expand Down Expand Up @@ -32,6 +34,7 @@ Contents
:maxdepth: 2

designers_notes
installing
tutorial
diceroll

Expand Down

0 comments on commit 82eba8d

Please sign in to comment.