Created
September 3, 2018 07:11
-
-
Save cozos/cff1ff5c30e4e2e17c7b7db6cee1ab29 to your computer and use it in GitHub Desktop.
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
import math | |
import random | |
rolls = [[random.randint(1,6) for i in xrange(4)] for j in xrange(6)] | |
# remove lowest roll | |
for roll in rolls: | |
roll.remove(min(roll)) | |
stats = [sum(roll) for roll in rolls] | |
random.shuffle(stats) | |
ATTRIBUTES = ["STR", "DEX", "CON", "INT", "WIS", "CHA"] | |
print [ | |
"{}: {} ({:+})".format(ATTRIBUTES[i], stats[i], int(math.floor((stats[i]-10)/2))) | |
for i in xrange(len(ATTRIBUTES)) | |
] | |
print "Average: {}".format(sum(stats) / len(stats)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment