Skip to content

Instantly share code, notes, and snippets.

@waynr
Last active May 17, 2019 13:17
Show Gist options
  • Save waynr/e41f17be5b15f798439a90995e6a89a1 to your computer and use it in GitHub Desktop.
Save waynr/e41f17be5b15f798439a90995e6a89a1 to your computer and use it in GitHub Desktop.
d&d ability score generator
#!/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