-
-
Save Grumblesaur/77a368ba73b131572bf1 to your computer and use it in GitHub Desktop.
4d6 drop 1 script for d20 system character creation
This file contains hidden or 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
from random import randint | |
import sys | |
#allow for python2 and python3 compatibility | |
if sys.version_info >= (3,0): | |
raw_input = input | |
#list of final attribute scores | |
statList = [] | |
#for each attribute on the character sheet | |
for y in range (0,6): | |
#roll 4d6 drop 1 | |
stat = [] | |
for x in range(0,4): | |
stat.append(randint(1,6)) | |
#find lowest roll to drop | |
smallest = stat[0] | |
for z in range (1,4): | |
if smallest > stat[z]: | |
smallest = stat[z] | |
#ignore the lowest roll | |
stat[stat.index(smallest)] = 0 | |
total = 0 | |
#compound the contents of the attribute roll | |
for h in range (0,4): | |
total += stat[h] | |
#add total to statList as attribute value | |
statList.append(total) | |
#print stats to console | |
for i in range(0, len(statList)): | |
sys.stdout.write(str(statList[i])) | |
sys.stdout.write("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment