Skip to content

Commit

Permalink
Removed D9
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnDriscoll committed Oct 17, 2019
1 parent 8210904 commit 86ae230
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 86 deletions.
47 changes: 21 additions & 26 deletions diceroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
diceroll_log.info('roll() v' + __version__ + ' started, and running...')

number_of_dice = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten']
simple_dice = ['D2', 'D3', 'D4', 'D6', 'D8', 'D9', 'D10', 'D12', 'D20', 'D30']
simple_dice = ['D2', 'D3', 'D4', 'D6', 'D8', 'D10', 'D12', 'D20', 'D30']

def _dierolls(dtype, dcount):
'''
Expand All @@ -72,10 +72,7 @@ def _dierolls(dtype, dcount):
diceroll_log.debug('Using %d %d-sided dice...' % (dcount, dtype))

for i in range(dcount):
if dtype == 9:
rolled = randint(1, 10) - 1
else:
rolled = randint(1, dtype)
rolled = randint(1, dtype)
if rolled == 8 or rolled == 11 or rolled == 18 or rolled >= 80 and rolled <= 89:
diceroll_log.debug('Rolled an %s' % rolled)
else:
Expand All @@ -86,16 +83,16 @@ def _dierolls(dtype, dcount):
def roll(dice):
'''
The dice types to roll are:
'D2', 'D3', 'D4', 'D6', 'D8', 'D9', 'D10',
'D12', 'D20', 'D30', 'D99', 'D100', 'D66', 'DD',
'D2', 'D3', 'D4', 'D6', 'D8', 'D09', 'D10',
'D12', 'D20', 'D30', 'D099', 'D100', 'D66', 'DD',
'FLUX', 'GOODFLUX', 'BADFLUX', 'BOON', 'BANE'
Some examples are:
roll('D6') or roll('1D6') -- roll one 6-sided die
roll('2D6') -- roll two 6-sided dice
roll('D9') -- roll a 10-sided die (0 - 9)
roll('D09') -- 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('D099') -- roll a 100-sided die (0 - 99)
roll('D100') -- roll a 100-sided die (1 - 100)
roll('D66') -- roll for a D66 chart
roll('FLUX') -- a FLUX roll (-5 to 5)
Expand Down Expand Up @@ -295,19 +292,20 @@ def roll(dice):
rolled = roll_1 * 10 + roll_2
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(9, 1) * 10
roll_2 = _dierolls(9, 1)
elif dice_type == 'D09' and num_dice == 1:
rolled = (_dierolls(10, 1) - 1) + dice_mod
diceroll_log.info('%s = %d%s+%d = %d' % (dice, num_dice, dice_type, dice_mod, rolled))
return rolled
elif dice_type == 'D099' and num_dice == 1:
roll_1 = (_dierolls(10, 1) - 1) * 10
roll_2 = (_dierolls(10, 1) - 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(9, 1) * 10
roll_2 = _dierolls(9, 1)
if roll_1 == 0 and roll_2 == 0:
rolled = 100 + dice_mod
else:
rolled = roll_1 + roll_2 + dice_mod
roll_1 = (_dierolls(10, 1) - 1) * 10
roll_2 = _dierolls(10, 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 == 'DD':
Expand All @@ -317,12 +315,9 @@ 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(9, 1) * 10
roll_2 = _dierolls(9, 1)
if roll_1 == 0 and roll_2 == 0:
rolled = 100 + dice_mod
else:
rolled = roll_1 + roll_2 + dice_mod
roll_1 = (_dierolls(10, 1) - 1) * 10
roll_2 = _dierolls(10, 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

Expand All @@ -335,9 +330,9 @@ 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('D9') -- roll a 10-sided die (0 - 9)"
print "roll('D09') -- 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('D099') -- 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"
print "roll('FLUX') -- a FLUX roll (-5 to 5)"
Expand Down
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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down
10 changes: 5 additions & 5 deletions docs/build/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ <h2>Installing Automatically<a class="headerlink" href="#installing-automaticall
<span class="go">(&#39;2.4&#39;, &#39;roll(), release version 2.4.3b for Classic Python 2.5.4&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">roll</span><span class="o">.</span><span class="n">__doc__</span>
<span class="go"> The dice types to roll are:</span>
<span class="go"> &#39;D2&#39;, &#39;D3&#39;, &#39;D4&#39;, &#39;D6&#39;, &#39;D8&#39;, &#39;D9&#39;, &#39;D10&#39;,</span>
<span class="go"> &#39;D12&#39;, &#39;D20&#39;, &#39;D30&#39;, &#39;D100&#39;, &#39;D66&#39;, &#39;DD&#39;,</span>
<span class="go"> &#39;D2&#39;, &#39;D3&#39;, &#39;D4&#39;, &#39;D6&#39;, &#39;D8&#39;, &#39;D09&#39;, &#39;D10&#39;,</span>
<span class="go"> &#39;D12&#39;, &#39;D20&#39;, &#39;D30&#39;, &#39;D099&#39;, &#39;D100&#39;, &#39;D66&#39;, &#39;DD&#39;,</span>
<span class="go"> &#39;FLUX&#39;, &#39;GOODFLUX&#39;, &#39;BADFLUX&#39;, &#39;BOON&#39;, &#39;BANE&#39;</span>
<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;D9&#39;) -- roll a 10-sided die (0 - 9)</span>
<span class="go"> roll(&#39;D09&#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;D099&#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>
<span class="go"> roll(&#39;FLUX&#39;) -- a FLUX roll (-5 to 5)</span>
Expand Down Expand Up @@ -235,7 +235,7 @@ <h3>Navigation</h3>
</div>
<div class="footer">
&copy; Copyright 2019, SHONNER CORP.
Last updated on Aug 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 0x0350A6C0>
<generator object at 0x0373A738>

<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 11, 2019.
Last updated on Oct 16, 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 11, 2019.
Last updated on Oct 16, 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 0x03695198>
<generator object at 0x03721D00>
<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 11, 2019.
Last updated on Oct 16, 2019.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
Expand Down

0 comments on commit 86ae230

Please sign in to comment.