def enter(self): global keypad print "Narrator: HEY!! NOT SO FAST!!! * erases part of script from paper *" print "Narrator: OOPSY DAISIES!!! LOOKS LIKE YOU FORGOT THE KEYPAD PASS" print "FOR THE ESCAPE PODS." raw_input() print "Oh, boohoo cheater.You have to guess all four of the numbers of the password." print "WOOPS! But I'm nice so you get to choose from numbers 5-9 to make it easier" keypad = random.sample(range(5, 9), 4) global nine_secs nine_secs = 0 while True: # Only run if the user types in "start" while nine_secs != 4: # Sleep for 9 seconds time.sleep(9) # Increment the minute total nine_secs += 1 # Loop until we reach 20 seconds if nine_secs == 1: print keypad[0] print "What does %d mean? Where did that number show up?" % keypad[ 0] print "I mean...yep, you have %d seconds left to press in the" % keypad[ 0] print "right password. You better get going...he...he..." if nine_secs == 2: print keypad[1] print "Yeah, now you have %d seconds before the ship blows up." % keypad[ 1] print "* narrator whispers to himself * I don't think he's catching on." print "What an idiot." if nine_secs == 3: print keypad[2] print "Uh..." if nine_secs == 4: print keypad[3] print "Should I keep trying?" print "Narrator of Narrator?: Guess the combination" global choice keypad = map(str, keypad) choice = raw_input() choice = (" ".join(choice)) choice = choice.split() if choice == keypad: print "Narrator of Narrater: You 'guessed' the right combination of numbers for the launch" print "and shoot your escape pod towards your home planet!" return 'finished' else: print "Wow, you're an idiiot!" return 'death' else: pass
def personalize(c, t): nameList = c.split(' ') firstName = nameList[0] lastName = nameList[1] t = t.split('\n') t = ' '.join(t) try: pos = en.sentence.tag(t) wordtag = map(list, zip(*pos)) words = wordtag[0] tags = wordtag[1] for i in range(len(words)): if words[i].lower() == "character" and i > 0: words[i-1] = firstName words[i] = lastName containsName = True elif tags[i] == "PRP": words[i] = firstName containsName = True elif tags[i] == "PRP$": words[i] = firstName+"\'s" cointainsName = True elif tags[i] in ["VBD", "VBG", "VBN", "VBZ"]: try: words[i] = en.verb.past(words[i], person=3, negate=False) except KeyError: pass elif words[i] == "trope": words[i] = "clue" elif words[i] == "tropes": words[i] = "clues" elif words[i] == "Trope": words[i] = "Clue" elif words[i] == "Tropes": words[i] = "Clues" elif words[i] == "have": words[i] = "has" elif words[i] == "are": words[i] = "is" else: pass punc = [".", ",", ";", ":", "!", "?"] for i in range(len(words)): if words[i] in punc: words[i] = '`'+words[i] final_text = " ".join(words) index = string.find(final_text, firstName) if final_text[index+len(firstName)+1:index+len(firstName)+1+len(lastName)] == lastName: final_text = final_text[index:] else: final_text = firstName+" "+lastName+final_text[index+len(firstName):] final_text = final_text.decode('utf8') final_text = final_text.encode('ascii', 'ignore') except: final_text = "" return final_text
def personalize(c, t): nameList = c.split(' ') firstName = nameList[0] lastName = nameList[1] t = t.split('\n') t = ' '.join(t) pos = en.sentence.tag(t) wordtag = map(list, zip(*pos)) words = wordtag[0] tags = wordtag[1] for i in range(len(words)): if words[i].lower() == "character" and i > 0: words[i - 1] = firstName words[i] = lastName containsName = True elif tags[i] == "PRP": words[i] = firstName containsName = True elif tags[i] == "PRP$": words[i] = firstName + "\'s" cointainsName = True elif tags[i] in ["VBD", "VBG", "VBN", "VBZ"]: try: words[i] = en.verb.past(words[i], person=3, negate=False) except KeyError: pass elif words[i] == "trope": words[i] = "clue" elif words[i] == "tropes": words[i] = "clues" elif words[i] == "Trope": words[i] = "Clue" elif words[i] == "Tropes": words[i] = "Clues" elif words[i] == "have": words[i] = "has" elif words[i] == "are": words[i] = "is" else: pass punc = [".", ",", ";", ":", "!", "?"] for i in range(len(words)): if words[i] in punc: words[i] = '`' + words[i] final_text = " ".join(words) index = string.find(final_text, firstName) if final_text[index + len(firstName) + 1:index + len(firstName) + 1 + len(lastName)] == lastName: final_text = final_text[index:] else: final_text = firstName + " " + lastName + final_text[index + len(firstName):] final_text = final_text.decode('utf8') final_text = final_text.encode('ascii', 'ignore') return final_text