Last active
December 15, 2015 07:09
-
-
Save gene1wood/5221523 to your computer and use it in GitHub Desktop.
Roll up an AD&D 1st Edition character
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 random | |
# 1st Ed ranger with 10% XP bonus | |
#target_stats = [15,15,14,15] | |
# 1st Ed ranger | |
#target_stats = [13,13,14,14] | |
# A coupld of 17s | |
target_stats = [17,17] | |
rolls = [] | |
character = [] | |
target_stats.sort() | |
target_stats.reverse() | |
while True: | |
roll = random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6) | |
rolls.append(roll) | |
character.append(roll) | |
if len(character) < 6: | |
continue | |
test = character[:] | |
test.sort() | |
test.reverse() | |
comp = target_stats[:] | |
match=0 | |
for stat in test: | |
if len(comp) > 0 and comp[0] <= stat: | |
del(comp[0]) | |
if len(comp) == 0: | |
break | |
del(character[0]) | |
print "All rolls : %s" % rolls | |
print "It took %s die rolls to get your character" % len(rolls) | |
print "Your character : %s" % character |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment