Skip to content

Commit

Permalink
D9 change
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnDriscoll committed Aug 11, 2019
1 parent 75c749b commit bfd1ffa
Show file tree
Hide file tree
Showing 22 changed files with 47 additions and 39 deletions.
20 changes: 11 additions & 9 deletions diceroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _dierolls(dtype, dcount):
diceroll_log.debug('Using %d %d-sided dice...' % (dcount, dtype))

for i in range(dcount):
if dtype == 10:
if dtype == 9:
rolled = randint(1, 10) - 1
else:
rolled = randint(1, dtype)
Expand All @@ -93,7 +93,8 @@ def roll(dice):
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 (0 - 9)
roll('D9') -- roll a 10-sided die (0 - 9)
roll('D10') -- roll a 10-sided die (1 - 10)
roll('D99') -- roll a 100-sided die (0 - 99)
roll('D100') -- roll a 100-sided die (1 - 100)
roll('D66') -- roll for a D66 chart
Expand Down Expand Up @@ -295,14 +296,14 @@ def roll(dice):
diceroll_log.info('%s = %d%s+%d = %d and %d = %d' % (dice, num_dice, dice_type, dice_mod, roll_1, roll_2, rolled))
return rolled
elif dice_type == 'D99' and num_dice == 1:
roll_1 = _dierolls(10, 1) * 10
roll_2 = _dierolls(10, 1)
roll_1 = _dierolls(9, 1) * 10
roll_2 = _dierolls(9, 1)
rolled = roll_1 + roll_2 + dice_mod
diceroll_log.info('%s = %d%s+%d = %d and %d + %d = %d' % (dice, num_dice, dice_type, dice_mod, roll_1, roll_2, dice_mod, rolled))
return rolled
elif dice_type == 'D100' and num_dice == 1:
roll_1 = _dierolls(10, 1) * 10
roll_2 = _dierolls(10, 1)
roll_1 = _dierolls(9, 1) * 10
roll_2 = _dierolls(9, 1)
if roll_1 == 0 and roll_2 == 0:
rolled = 100 + dice_mod
else:
Expand All @@ -316,8 +317,8 @@ def roll(dice):
elif dice_type == 'D00' and num_dice == 1:
log.warning('D00 was deprecated in 1.9. Use D100 instead.')
diceroll_log.warning('D00 was deprecated in 1.9. Use D100 instead.')
roll_1 = _dierolls(10, 1) * 10
roll_2 = _dierolls(10, 1)
roll_1 = _dierolls(9, 1) * 10
roll_2 = _dierolls(9, 1)
if roll_1 == 0 and roll_2 == 0:
rolled = 100 + dice_mod
else:
Expand All @@ -334,7 +335,8 @@ def roll(dice):
print "Valid dice rolls are:"
print "roll('D6') or roll('1D6') -- roll one 6-sided die"
print "roll('2D6') -- roll two 6-sided dice"
print "roll('D10') -- roll a 10-sided die (0 - 9)"
print "roll('D9') -- roll a 10-sided die (0 - 9)"
print "roll('D10') -- roll a 10-sided die (1 - 10)"
print "roll('D99') -- roll a 100-sided die (0 - 99)"
print "roll('D100') -- roll a 100-sided die (1 - 100)"
print "roll('D66') -- roll for a D66 chart"
Expand Down
Binary file removed diceroll_2.4.3b.zip
Binary file not shown.
Binary file modified docs/build/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/.doctrees/introduction.doctree
Binary file not shown.
Binary file modified docs/build/.doctrees/tutorial.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/about_the_author.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/debugging.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/designers_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/diceroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/glossary.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
5 changes: 3 additions & 2 deletions docs/build/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ <h2>Installing Automatically<a class="headerlink" href="#installing-automaticall
<span class="go"> Some examples are:</span>
<span class="go"> roll(&#39;D6&#39;) or roll(&#39;1D6&#39;) -- roll one 6-sided die</span>
<span class="go"> roll(&#39;2D6&#39;) -- roll two 6-sided dice</span>
<span class="go"> roll(&#39;D10&#39;) -- roll a 10-sided die (0 - 9)</span>
<span class="go"> roll(&#39;D9&#39;) -- roll a 10-sided die (0 - 9)</span>
<span class="go"> roll(&#39;D10&#39;) -- roll a 10-sided die (1 - 10)</span>
<span class="go"> roll(&#39;D99&#39;) -- roll a 100-sided die (0 - 99)</span>
<span class="go"> roll(&#39;D100&#39;) -- roll a 100-sided die (1 - 100)</span>
<span class="go"> roll(&#39;D66&#39;) -- roll for a D66 chart</span>
Expand Down Expand Up @@ -234,7 +235,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/license.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
4 changes: 2 additions & 2 deletions 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.4 Operations Manual" href="index.html" />
<generator object at 0x03568440>
<generator object at 0x0350A6C0>

<script type="text/javascript">
DOCUMENTATION_OPTIONS.COLLAPSE_MODINDEX = true;
Expand Down Expand Up @@ -92,7 +92,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/samples.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
4 changes: 2 additions & 2 deletions 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.4 Operations Manual" href="index.html" />
<generator object at 0x03867B20>
<generator object at 0x03695198>
<script type="text/javascript" src="_static/searchtools.js"></script>

</head>
Expand Down Expand Up @@ -83,7 +83,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
7 changes: 4 additions & 3 deletions docs/build/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ <h2>Rolling the Dice<a class="headerlink" href="#rolling-the-dice" title="Permal
<p>Some examples are:</p>
<div class="highlight"><pre><span class="n">roll</span><span class="p">(</span><span class="s">&#39;D6&#39;</span><span class="p">)</span> <span class="ow">or</span> <span class="n">roll</span><span class="p">(</span><span class="s">&#39;1D6&#39;</span><span class="p">)</span> <span class="c"># roll one 6-sided die</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;2D6&#39;</span><span class="p">)</span> <span class="c"># roll two 6-sided dice</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;D10&#39;</span><span class="p">)</span> <span class="c"># roll a 10-sided die (0 - 9)</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;D9&#39;</span><span class="p">)</span> <span class="c"># roll a 10-sided die (0 - 9)</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;D10&#39;</span><span class="p">)</span> <span class="c"># roll a 10-sided die (1 - 10)</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;D99&#39;</span><span class="p">)</span> <span class="c"># roll a 100-sided die (0 - 99)</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;D100&#39;</span><span class="p">)</span> <span class="c"># roll a 100-sided die (1 - 100)</span>
<span class="n">roll</span><span class="p">(</span><span class="s">&#39;D66&#39;</span><span class="p">)</span> <span class="c"># roll for a D66 chart</span>
Expand Down Expand Up @@ -152,7 +153,7 @@ <h2>Rolling the Dice<a class="headerlink" href="#rolling-the-dice" title="Permal
</pre></div>
<p>The roll will return a list of percentages for 2-12 rolled.</p>
<p><em>Fixed in version 2.4.2</em></p>
<p>D10 rolls are now in the range of 0 - 9 instead of 1 - 10.</p>
<p>D9 rolls are now in the range of 0 - 9 instead of 1 - 9.</p>
<p><em>New in version 2.4.3</em></p>
<p>D99 rolls will generate a range of 0 - 99.</p>
</div>
Expand Down Expand Up @@ -207,7 +208,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 01, 2019.
Last updated on Aug 11, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
3 changes: 2 additions & 1 deletion docs/source/databox1.dat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
roll('D6') or roll('1D6') # roll one 6-sided die
roll('2D6') # roll two 6-sided dice
roll('D10') # roll a 10-sided die (0 - 9)
roll('D9') # roll a 10-sided die (0 - 9)
roll('D10') # roll a 10-sided die (1 - 10)
roll('D99') # roll a 100-sided die (0 - 99)
roll('D100') # roll a 100-sided die (1 - 100)
roll('D66') # roll for a D66 chart
Expand Down
20 changes: 11 additions & 9 deletions docs/source/diceroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _dierolls(dtype, dcount):
diceroll_log.debug('Using %d %d-sided dice...' % (dcount, dtype))

for i in range(dcount):
if dtype == 10:
if dtype == 9:
rolled = randint(1, 10) - 1
else:
rolled = randint(1, dtype)
Expand All @@ -93,7 +93,8 @@ def roll(dice):
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 (0 - 9)
roll('D9') -- roll a 10-sided die (0 - 9)
roll('D10') -- roll a 10-sided die (1 - 10)
roll('D99') -- roll a 100-sided die (0 - 99)
roll('D100') -- roll a 100-sided die (1 - 100)
roll('D66') -- roll for a D66 chart
Expand Down Expand Up @@ -295,14 +296,14 @@ def roll(dice):
diceroll_log.info('%s = %d%s+%d = %d and %d = %d' % (dice, num_dice, dice_type, dice_mod, roll_1, roll_2, rolled))
return rolled
elif dice_type == 'D99' and num_dice == 1:
roll_1 = _dierolls(10, 1) * 10
roll_2 = _dierolls(10, 1)
roll_1 = _dierolls(9, 1) * 10
roll_2 = _dierolls(9, 1)
rolled = roll_1 + roll_2 + dice_mod
diceroll_log.info('%s = %d%s+%d = %d and %d + %d = %d' % (dice, num_dice, dice_type, dice_mod, roll_1, roll_2, dice_mod, rolled))
return rolled
elif dice_type == 'D100' and num_dice == 1:
roll_1 = _dierolls(10, 1) * 10
roll_2 = _dierolls(10, 1)
roll_1 = _dierolls(9, 1) * 10
roll_2 = _dierolls(9, 1)
if roll_1 == 0 and roll_2 == 0:
rolled = 100 + dice_mod
else:
Expand All @@ -316,8 +317,8 @@ def roll(dice):
elif dice_type == 'D00' and num_dice == 1:
log.warning('D00 was deprecated in 1.9. Use D100 instead.')
diceroll_log.warning('D00 was deprecated in 1.9. Use D100 instead.')
roll_1 = _dierolls(10, 1) * 10
roll_2 = _dierolls(10, 1)
roll_1 = _dierolls(9, 1) * 10
roll_2 = _dierolls(9, 1)
if roll_1 == 0 and roll_2 == 0:
rolled = 100 + dice_mod
else:
Expand All @@ -334,7 +335,8 @@ def roll(dice):
print "Valid dice rolls are:"
print "roll('D6') or roll('1D6') -- roll one 6-sided die"
print "roll('2D6') -- roll two 6-sided dice"
print "roll('D10') -- roll a 10-sided die (0 - 9)"
print "roll('D9') -- roll a 10-sided die (0 - 9)"
print "roll('D10') -- roll a 10-sided die (1 - 10)"
print "roll('D99') -- roll a 100-sided die (0 - 99)"
print "roll('D100') -- roll a 100-sided die (1 - 100)"
print "roll('D66') -- roll for a D66 chart"
Expand Down
3 changes: 2 additions & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ Some ways to see if the ``diceroll`` module was installed correctly is by typing
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 (0 - 9)
roll('D9') -- roll a 10-sided die (0 - 9)
roll('D10') -- roll a 10-sided die (1 - 10)
roll('D99') -- roll a 100-sided die (0 - 99)
roll('D100') -- roll a 100-sided die (1 - 100)
roll('D66') -- roll for a D66 chart
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ The roll will return a list of percentages for 2-12 rolled.

*Fixed in version 2.4.2*

D10 rolls are now in the range of 0 - 9 instead of 1 - 10.
D9 rolls are now in the range of 0 - 9 instead of 1 - 9.

*New in version 2.4.3*

Expand Down

0 comments on commit bfd1ffa

Please sign in to comment.