Last active
May 17, 2019 13:17
-
-
Save waynr/e41f17be5b15f798439a90995e6a89a1 to your computer and use it in GitHub Desktop.
d&d ability score generator
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
#!/usr/bin/env python3 | |
import random | |
import click | |
def abscore(): | |
rolls = [random.randint(2,6) for i in range(4)] | |
rolls.sort() | |
return sum(rolls[1:]) | |
@click.command() | |
def roller(): | |
for i in range(6): | |
scores = [abscore() for i in range(6)] | |
scores.sort() | |
scores.reverse() | |
print("{} sum: {}".format(scores, sum(scores))) | |
if __name__ == "__main__": | |
roller() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment