Skip to content

Instantly share code, notes, and snippets.

@AndrewS097
Created March 10, 2019 07:21
Show Gist options
  • Save AndrewS097/e9624745074377a43accbde11f3be5c7 to your computer and use it in GitHub Desktop.
Save AndrewS097/e9624745074377a43accbde11f3be5c7 to your computer and use it in GitHub Desktop.
Office Based Guess Who
import random
game = 1
guess_attempts=0
#pam declerations
pam_hair='brown'
pam_occupation='reception'
pam_age='medium'
pam_gender='girl'
pam_skin = 'white'
#jim declerations
jim_hair='brown'
jim_occupation='sales'
jim_age='medium'
jim_gender='male'
jim_skin = 'guy'
#creed declerations
creed_hair='grey'
creed_occupation= 'inspector'
creed_age='old'
creed_skin='white'
creed_gender='guy'
#dweight declerations
dweight_hair= 'brown'
dweight_occupation='sales'
dweight_age = 'medium'
dweight_skin ='color'
dweight_gender='guy'
#stanley declerations
stanley_hair='black'
stanley_occupation='sales'
stanley_skin ='black'
stanley_age='old'
stanley_gender = 'guy'
#kevin declerations
kevin_hair ='brown'
kevin_occupation ='accounting'
kevin_skin = 'white'
kevin_age = 'medium'
kevin_gender ='guy'
#clark declerations
clark_hair ='brown'
clark_occupation = 'temp'
clark_skin = 'white'
clark_age = 'young'
clark_gender = 'guy'
#erin declerations
erin_hair = 'brown'
erin_occupation = 'receptionist'
erin_skin = 'white'
erin_age = 'young'
erin_gender = 'girl'
#andy declerations
andy_hair = 'black'
andy_occupation = 'sales'
andy_skin = 'white'
andy_age ='medium'
andy_gender ='guy'
#meredith declerations
meredith_hair = 'red'
meredith_occupation ='inspector'
meredith_skin = 'white'
meredith_age = 'old'
meredith_gender = 'girl'
#angela declerations
angela_hair ='blonde'
angela_occupation = 'accouting'
angela_skin = 'white'
angela_age = 'medium'
angela_gender = 'girl'
#toby declerations
toby_hair ='brown'
toby_occupation= 'human resources'
toby_skin = 'white'
toby_age = 'old'
toby_gender = 'guy'
#oscar declerations
oscar_hair = 'black'
oscar_occupation = 'accounting'
oscar_skin = 'brown'
oscar_age = 'medium'
oscar_gender = 'guy'
#darryl declerations
darryl_hair = 'black'
darryl_occupation ='warehouse'
darryl_skin = 'black'
darryl_age = 'medium'
darryl_gender = 'guy'
#phyllis declerations
phyllis_hair = 'brown'
phyllis_occupation = 'sales'
phyllis_skin = 'white'
phyllis_age = 'old'
phyllis_gender = 'girl'
#michael declerations
michael_hair ='black'
michael_occupation = 'manager'
michael_skin = 'white'
michael_age = 'old'
michael_gender = 'guy'
random= random.randint(1,16)
if (random==1):
hair_color =pam_hair
occupation=pam_occupation
age=pam_age
skin_color=pam_skin
gender=pam_gender
person = 'Pam'
if (random==2):
hair_color =jim_hair
occupation=jim_occupation
age=jim_age
skin_color=jim_skin
gender=jim_gender
person = 'Jim'
if (random==3):
hair_color =creed_hair
occupation=creed_occupation
age=creed_age
skin_color=creed_skin
gender=creed_gender
person = 'Creed'
if (random==4):
hair_color =dweight_hair
occupation=dweight_occupation
age=dweight_age
skin_color=dweight_skin
gender=dweight_gender
person = 'Dweight'
if (random==5):
hair_color =stanley_hair
occupation=stanley_occupation
age=stanley_age
skin_color=stanley_skin
gender=stanley_gender
person = 'Stanley'
if (random==6):
hair_color =kevin_hair
occupation=kevin_occupation
age=kevin_age
skin_color=kevin_skin
gender=kevin_gender
person = 'Kevin'
if (random==7):
hair_color =clark_hair
occupation=clark_occupation
age=clark_age
skin_color=clark_skin
gender=clark_gender
person = 'Clark'
if (random==8):
hair_color =meredith_hair
occupation=meredith_occupation
age=meredith_age
skin_color=meredith_skin
gender=meredith_gender
person = 'Meredith'
if (random==9):
hair_color =andy_hair
occupation=andy_occupation
age=andy_age
skin_color=andy_skin
gender=andy_gender
person = 'Andy'
if (random==10):
hair_color =erin_hair
occupation=erin_occupation
age=erin_age
skin_color=erin_skin
gender=erin_gender
person = 'Erin'
if (random==11):
hair_color =angela_hair
occupation=angela_occupation
age=angela_age
skin_color=angela_skin
person = 'Angela'
gender=angela_gender
if (random==12):
hair_color =toby_hair
occupation=toby_occupation
age=toby_age
skin_color=toby_skin
gender=toby_gender
person = 'Toby'
if (random==13):
hair_color =oscar_hair
occupation=oscar_occupation
age=oscar_age
skin_color=oscar_skin
gender=oscar_gender
person = 'Oscar'
if (random==14):
hair_color =darryl_hair
occupation=darryl_occupation
age=darryl_age
skin_color=darryl_skin
gender=darryl_gender
person = 'Darryl'
if (random==15):
hair_color =phyllis_hair
occupation=phyllis_occupation
age=phyllis_age
skin_color=phyllis_skin
gender=phyllis_gender
person = 'Phyllis'
if (random==16):
hair_color =michael_hair
occupation=michael_occupation
age=michael_age
skin_color=michael_skin
gender=michael_gender
person = 'Michael'
print ("Hello and welcome to guess who where you try to figure out which office character the computer has picked. Ask questios regarding hair color occupation, age, skin color, or gender in such format..... Is their hair color red? Is their occupation accounting? Is their skin color black? Is their gender male?... Guess and narrow down the search untill you're ready to guess the person. And then ask Is the person..... Goodluck \n")
print ("The list of charcters is as follows..\n ")
print ("Pam Has brown hair, skin color is white, occupation is reception, her age is medium, her gender is female\n")
print (" Jim Has brown hair, skin color is white, ccupation is sales, his age is medium, his gender is male\n")
print (" Creed Has gray hair, skin color is white occupation is inspector, his age is old, his gender is male\n")
print (" Dweight Has brown hair, skin color is white, occupation is sales, his age is medium, his gender is male\n")
print ("Stantley Has black hair, skin color is black, occupation is sales, his age is old, his gender is male\n")
print ("Kevin Has brown hair, skin color is white, occupation is accounting, his age is medium, his gender is male\n")
print ("Clark Has brown hair, skin color is white, occupation is temp, his age is young, his gender is male\n")
print ("Erin Has brown hair, skin color is white, occupation is reception, her age is medium, her gender is female\n")
print ("Andy Has black hair, skin is white, occupation is sales, his age is medium, his gender is male\n")
print ("Meredith Has red hair, skin color is white, occupation is sales, fer age is old, fer gender is female\n")
print ("Angela Has blonde hair, skin color is white, occupation is accounting, her age is medium, her gender is female\n")
print ("Toby Has brown hair, skin color is white, occupation is human resources, his age is medium, his gender is male\n")
print ("Oscar Has brown hair, skin color is brown, Oscar's occupation is accounting, his age is medium, his gender is male\n")
print ("Phyllis Has brown hair, skin color is white occupation is sales, her age is old, her gender is female\n")
print ("Darryl Has black hair, skin color is black, occupation is warehouse, his age is medium, his gender is male\n")
print ("Michael Has brown hair, skin color is white, occupation is manager, his age is old, his gender is male\n")
while (game !=0 ):
question=input("What is your question?")
if (question.find('hair') != -1):
if (question.find(hair_color) != -1):
print ("Yes her hair is that color")
else:
print ("No his/her hair is not that color")
if (question.find('gender') != -1):
if (question.find(gender) != -1):
print ("Yes that is his/her gender")
else:
print ("No that is not his/her gender")
if (question.find('occupation') != -1):
if (question.find(occupation) != -1):
print ("Yes her/his occupation is")
else:
print ("No his/her occupation is not that ")
if (question.find('age') != -1):
if (question.find(age) != -1):
print ("Yes her age is that")
else:
print ("No his/her age is not that")
if (question.find('skin') != -1):
if (question.find(skin_color) != -1):
print ("Yes her/her skin color is that")
else:
print ("No his/her skin color is not that")
if (question.find('person') != -1):
if (question.find(person) != -1):
print ("Yes that is the person congrats you win!")
game = 0
else:
print ("No that is not them")
guess_attempts +=1
if (guess_attempts == 20):
print ("Too many attempts you suck")
game = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment