[Tutor] AD&D Character generator problems

sjb@crosswinds.net sjb@crosswinds.net
Tue, 4 Apr 2000 00:22:13 -0500


To test out my abilities so far I am writing an AD&D character generator. It
is going fine so far except that even if I tell the program not to it still
re-rolls the character's stats. Hopefully someone here can spot the problem. 


# Samuel Bridgeland
# --a script to generate AD&D 2nd ed. characters--

import random

# ask for a name and make a file for it
CharName= raw_input("What will you character's name be? ")
CharFile= open(CharName, 'w')

# generate stats for the character
statlist= ['str', 'dex', 'con', 'int', 'wis', 'cha']
stats= {'str': 0, 'dex': 0, 'con': 0, 'int': 0, 'wis': 0, 'cha': 0}

def MakeStats():
    for genstat in statlist:
	stats[genstat]= random.randint(3, 18)
    for stat in statlist:
	print stat, ':', stats[stat]

def OkStats():
    goodstats= raw_input("Re-roll? ")
    if goodstats == 'yes' or 'y':
	MakeStats()
    elif goodstats == 'no' or 'n':
	return ''
    else:
	print "(y)es or (n)o please."
	OkStats()

MakeStats()
OkStats()
	

And I know the rest isn't important(because the rest has yet to be written).

-- 
                                    
SJB                                
sjb@crosswinds.net