Skip to content

Instantly share code, notes, and snippets.

@edwardmoon
Last active August 29, 2015 14:05
Show Gist options
  • Save edwardmoon/0e6e177206a8486a1e23 to your computer and use it in GitHub Desktop.
Save edwardmoon/0e6e177206a8486a1e23 to your computer and use it in GitHub Desktop.
python version of tfts generate.sh
from __future__ import print_function
# try to support python 3
import pickle
import random
class human:
name = ""
age = 0
gender = 0
glasses = False
weight = 0
length = 0
hair = 0
height = (0, 0) # feet and inches
strength = 0
dexterity = 0
constitution = 0
intelligence = 0
wisdom = 0
charisma = 0
job = 0
breasts = 0
eyes = 0
flavor = ""
def __init__(self, name, gender):
self.name = name
self.gender = gender
# set body attributes
self.age = dice(17, 40)
self.weight = dice(90, 180)
self.hair = dice(0,5)
self.length = dice(0,3)
self.eyes = dice(0,3)
self.height = (dice(4,6), dice(0,11))
if (gender): # female
self.breasts = dice(0,5)
self.glasses = dice(0,1)
self.job = dice(1,6)
# set stats
self.strength = dice(3,18)
self.dexterity = dice(3,18)
self.constitution = dice(3,18)
self.intelligence = dice(3,18)
self.wisdom = dice(3,18)
self.charisma = dice(3,18)
# should move this to a method
# setting flavor text
if (self.gender == 1): # female
if (self.job == 0): # CEO
if (self.intelligence == 3):
self.flavor = "You stare blankly at the square box in front of you and scratch at your $HAIR hair. You know this box is supposed to do something. You smack it thinking it might help. Unfortunantly it seems smacking it caused a piece to fall off. Picking it up you examine it and pull out a hammer. Knowing full well this will fix the problem."
elif (self.intelligence <= 14):
self.flavor = "Being a woman, it's been hard to be in the lime light of the company, being that your not particulary smart. Especially in the IT field. You think secretly the IT scum are making fun of you behind your back. You always just merely flip your $LENGTH $HAIR hair and turn your nose up at them as they walk by. Knowing full well they like the view as you walk away."
elif (self.intelligence <= 17):
self.flavor = "Being that your a woman and the owner of your own company. Not many think that your smart, but the IT guys seem to have your back when it comes to questions. They're nice and respectful and you always seem to have the right questions and follow through with there advice. You may be no tech guru, but you sure as hell try."
else:
self.flavor = "It's been rough being a woman, and being extremely intelligient. Especially to the IT crowd. Not many women fills it's rosters. You made this company, and grew it from the ground up with barely any need of an IT crew. You hire them anyways though to carry out the tasks you deem necessary and they don't seem to really complain to much. They know your not stupid and respect your decisions."
elif (self.job == 0): # flavor for male CEO
if (self.intelligence == 3):
self.flavor = "You stare blankly at the square box in front of you and scratch at your $HAIR hair. You know this box is supposed to do something. You smack it thinking it might help. Unfortunantly it seems smacking it caused a piece to fall off. Picking it up you examine it and pull out a hammer. Knowing full well this will fix the problem."
elif (self.intelligence <= 14):
self.flavor = "You are the big cheese, the boss to end all bosses. Those IT guys and there thingy majigures aren't anything to you. You rule this company with an iron fist and it doesn't matter a lick that you don't even know what a survore is."
elif (self.intelligence <= 17):
self.flavor = "Looking at your email you notice you've lost connection to the exchange server. Knowing thats a pretty bad thing you call up the IT department just to double check they're on the case. Knowing full well they're probably already on it. You love your IT guys, they keep the world revolving."
else:
self.flavor = "You've pretty much single handedly programmed every server in the company and often times find yourself in the IT department just to get your hands dirty. The IT guys love you and often come to your own office just to chit chat. You always make sure the IT department is well taken care of and often make sure the rest of your employees go through your general computing classes."
if (self.job == 1): # Vice-President
if (self.intelligence == 3):
self.flavor = "completely and utter failure at Vice-President"
elif (self.intelligence <= 14):
self.flavor = "Dumb Vice-President"
elif (self.intelligence <= 17):
self.flavor = "Semi-smart Vice-President"
else:
self.flavor = "Smart Vice-President"
elif (self.job == 2): # Human Resources
if (self.intelligence == 3):
self.flavor = "completely and utter failure at Human Resources"
elif (self.intelligence <= 14):
self.flavor = "Dumb Human Resources"
elif (self.intelligence <= 17):
self.flavor = "Semi-smart Resources"
else:
self.flavor = "Smart Human Resources"
elif (self.job == 3): # IT Manager
if (self.intelligence == 3):
self.flavor = "completely and utter failure at IT Manager"
elif (self.intelligence <= 14):
self.flavor = "Dumb IT Manager"
elif (self.intelligence <= 17):
self.flavor = "Semi-smart IT Manager"
else:
self.flavor = "Smart IT Manager"
elif (self.job == 4): # Sales Floor Employee
if (self.intelligence == 3):
self.flavor = "completely and utter failure at Sales Floor Employee"
elif (self.intelligence <= 14):
self.flavor = "Dumb Sales Floor Manager"
elif (self.intelligence <= 17):
self.flavor = "Semi-smart Sales Floor Manager"
else:
self.flavor = "Smart Sales Floor Manager"
def __str__ (self):
SEX = ['male', 'female']
JOB = ['CEO', 'Vice-President', 'Human Resources', 'IT Manager', 'Tech Support', 'Sales Floor Employee']
HAIR = ['white', 'black', 'red', 'blonde', 'brunette', 'grey']
LENGTH = ['Short', 'Medium', 'Long', 'Super Long']
EYES = ['Brown', 'Blue', 'Green', 'Hazel']
print("Name: %s" % (self.name,))
print("Age: %d" % (self.age,))
print("Gender: %s" % (SEX[self.gender]))
if (self.glasses) == 0:
print("Eyes: %s and wears glasses" % (EYES[self.eyes],))
else:
print("Eye color: %s", (SEX[self.gender]))
print("Weight: %d" % (self.weight,))
print("")
print("STR: %02d" % (self.strength,))
print("DEX: %02d" % (self.dexterity,))
print("CON: %02d" % (self.constitution,))
print("INT: %02d" % (self.intelligence,))
print("WIS: %02d" % (self.wisdom,))
print("CHA: %02d" % (self.charisma,))
print(self.flavor)
return ""
def save(self):
filename = self.name + ".pkl"
f = open(filename, 'w')
pickle.dump(self, f)
f.close()
def load(self, filename):
fname = filename + ".pkl"
f = open(fname, 'r')
person = pickle.load(f)
f.close()
return person
def dice(lo, hi):
return random.randrange(lo, hi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment