def run_fortune_teller(): enter(welcome) enter(wizard_room) # print(welcome) # print(wizard_room) game_on = False ask_question = 'N' while ask_question != 'Y' and ask_question != 'y': ask_question = enter('''"May I ask you some questions? As a warning, you will not exit this room until you speak with me.\" (enter Y or N)''' ) if ask_question != 'Y' and ask_question != 'y': game_on = False else: game_on = True name = "" while game_on == True: if name == "": name = enter('"Tell me your name my dear"\n') if name == "": print("Name cannot be empty!") continue birth_year = enter('"And what is your birth year?"\n') if birth_year == "": print("Birth Year cannot be empty!") continue fortune_topic() enter(''' "You can now exit my room!"\n But wait... as she heads toward the door she takes a stumble on the sash of her robe. It's a hard fall. When she arises she is completely incomprehensible. ''') exit_key() game_on = False
def fortune_topic(): topics = ["love", "money", "happiness"] love_wealth_happiness = "" while love_wealth_happiness not in topics: love_wealth_happiness = enter( '''"There much to tell but we don\'t have much time. Would you like to learn about love, money, or happiness?"\n (Please type 'love,' 'money,' or 'happiness' to select)\n''').lower() if love_wealth_happiness in topics: enter('''%s it is. \n %s ''' % (love_wealth_happiness.title(), random_quote(love_wealth_happiness))) else: enter("Please spell correctly!")
def exit_key(): enter(''' Oh dear. The wizard has forgotten English.\n She has begun to speak Wizard! You still need the secret code to exit her room.''') enter(''' But don't be alarmed. Wizard speak is easy to learn.\n Go take a look at the marble tablet hanging on the door.''') print(Back.BLACK + Fore.MAGENTA + ''' "Psviq 4twyq hspsv wmx eqix, gsrwigxixyv ehmtmwgmrk ipmx. Tippirxiwuyi 8jj ijjmgmxyv evgy. Wywtirhmwwi lymw yvre jvmrkmppe, ikiwxew svgm rig, psfsvxmw rmfl. Qeyvmw 0x qsppmw ivex. Gvew 9ip yvre zipmx. Ixmeq 6eygmfyw pmfivs zip xyvtmw gyvwyw, ex yppeqgsvtiv rmwp gsrwigxixyv. Ryppeq 3mx eqix pygxyw wetmir. Req 5srzeppmw ivsw e typzmrev gsrwiuyex. Mr zilmgype, pmkype tsvxxmxsv tlevixve jivqirxyq, jipmw hspsv jegmpmwmw eykyi, mh kvezmhe ryppe zipmx eg svgm. Wywtirhmwwi 2kix eygxsv zipmx. "Ryppeq 7y shms iy hmeq kvezmhe xiqtyw ijjmgmxyv iy pmfivs. Eirier 0pmuyix gsrkyi qsppmw."''') print(Fore.WHITE + Back.BLACK) print(Fore.WHITE + Back.BLACK + '''\n The exit code is embedded in this Wizard speak. Read my instructions carefully.\n --Take the FIRST CHARACTER of the SECOND WORD in EACH SENTENCE to make a 12 character code. \n --You only have 3 tries, so yes, be careful! ''') # code = input(" Enter code here: ") # clean_code = no_spaces(code) acc = 0 countdown = 3 while acc < 3: code = input(" Enter code here: ") print() clean_code = no_spaces(code) if clean_code == "48l09635z270": print() print(''' Your passphrase is: {} \n'''.format(leet_speak(code))) enter(Fore.WHITE + "The door opens!") break elif clean_code == "cheatcode": print() print(" Your passphrase is: " + Fore.YELLOW + "goldenwizard" + Fore.WHITE) enter(Fore.WHITE + "The door opens!") break else: acc += 1 countdown -= 1 print(f"Try again! You have {countdown} tries left!\n") if countdown == 0: print("Game over! You are stuck in the wizard room forever.") exit()
def room4(): print( """\n\n\n\nAfter a long and daunting journey through the Fun Fair Maze, you have entered the fourth and final room! \nYou notice this is a room of elegance.\nThe white marble tiled floors are accented with gold and the walls are covered with pristine art from around the world.\nIn the middle of the room, hangs a large diamond chandelier.\nAfter looking around for a few moments, you estimate that this room is about 20x20 feet.\n\nAll of a sudden, a large troll dressed in robes of royalty forms from the floor directly beneath the chandelier.\nThe troll is holding some sort of glowing angelic orb.\n\nThe troll exclaims; "I am Gorgish, King of the Fun Fair Maze!\nIn order to exit the maze, you must give me the three items you've acquired from the former rooms.\nThen you must answer my riddle that only a true Fun Fair Maze Champion would know.\n\nIf you guess correctly, my orb will wisk you away to safety.\nBeware, you will only get three guesses to answer my riddle correctly.\nIf you fail, you will be crushed into oblivion.""" ) room1_unlocked = input( """\n\n\n\n Gorgish asks; "What is the passcode from Wizard Room?" """) # The troll is asking if you for the correct code from room 1 room1answer = room1_unlocked if room1answer in [ "GOLDENWIZARD", "goldenwizard", "golden wizard", "GOLDEN WIZARD", "Golden Wizard" ]: print("\n\nExcellent. Your passcode is correct.") #The troll is asking if you brought the correct item from room2 room2_unlocked = input( """\n\nGorgish asks; "What did you bring me from Axe Room?" """) room2answer = room2_unlocked if room2answer in [ "Golden axe", "golden axe", "Golden Axe", "GOLDEN AXE", "GoldenAxe", 'goldenaxe' ]: print( "\n\n\nExcellent. You hand it over to Gorgish. Trolls are so greedy." ) #The troll is asking if you brought the correct item from room3 room3_unlocked = input( """\n\nGorgish asks; "What did you bring me from Tomato Room?" """ ) room3answer = room3_unlocked if room3answer in [ "Golden Tomato", "golden tomato", "GOLDEN TOMATO", "GoldenTomato", "goldentomato", "GOLDENTOMATO", "goldentomato" ]: print( "\n\n\nEXCELLENT! You have moved onto the final challange: The Fun Fair Maze Riddle." ) #the troll is asking the final riddle final_riddle_answer = input( """\n\nGorgish says; "Such amazing loot you have brought to me! Here is your Final Riddle:\n"I have numerous teeth\nAnd I'm kept on a chain\nI'm the singer's delight\nAnd the burglar's disdain... \nWhat is your answer?" """ ) answer = final_riddle_answer if answer in ["A key", "a key", "A KEY", "A Key"]: enter( """\n\n\n\n*W*I*N*N*E*R****W*I*N*N*E*R****W*I*N*N*E*R***W*I*N*N*E*R***\nKing Gorgish says; "You are correct! You may return to safety!" \nGorgish's orb glows bright white, the power of the orb pulls you into it. \nYou and the orb are now one! Beams of bright light radiate out of you.\nThe room of elegance slowly fades to dark.\nSuddenly you are transported to the entrance of the maze.\nYOU ARE CHAMPION OF THE FUN FAIR MAZE!\n*W*I*N*N*E*R****W*I*N*N*E*R****W*I*N*N*E*R***W*I*N*N*E*R***""" ) else: print( """\n\n\n\nGorgish says; "Wrong!" The elegant room shrinks drastically. The room now appears to be 10x10 in size.\nYou are worried if you answer wrong two more times, you'll be smashed into oblivion.""" ) final_riddle_answer = input( "\n\n\n\nGuess again. You only have two remaining guess: " ) answer = final_riddle_answer if answer in ["A key", "a key", "A KEY", "A Key"]: print( """\n\n\n\n*W*I*N*N*E*R****W*I*N*N*E*R****W*I*N*N*E*R***W*I*N*N*E*R***\nKing Gorgish says; "You are correct! You may return to safety!" \nGorgish's orb glows bright white, the power of the orb pulls you into it. \nYou and the orb are now one! Beams of bright light radiate out of you.\nThe elegant room slowly fades to dark.\nSuddenly you are transported to the entrance of the maze.\nYOU ARE CHAMPION OF THE FUN FAIR MAZE!\n*W*I*N*N*E*R****W*I*N*N*E*R****W*I*N*N*E*R***W*I*N*N*E*R***""" ) else: print( """\n\n\n\nGorgish says; "Wrong Again!" The elegant shrinks even more. The room now appears to be 5x5 in size.\nYou are worried that if you answer wrong one more time, you'll be smashed into oblivion.""" ) final_riddle_answer = input( "\n\n\n\nGuess again. You have one more guess: ") answer = final_riddle_answer if answer in ["A key", "a key", "A KEY", "A Key"]: print( """\n\n\n\n*W*I*N*N*E*R****W*I*N*N*E*R****W*I*N*N*E*R***W*I*N*N*E*R***\nKing Gorgish says; "You are correct! You may return to safety!" \nGorgish's orb glows bright white, the power of the orb pulls you into it. \nYou and the orb are now one! Beams of bright light radiate out of you.\nThe elegant room slowly fades to dark.\nSuddenly you are transported to the entrance of the maze.\nYOU ARE CHAMPION OF THE FUN FAIR MAZE!\n*W*I*N*N*E*R****W*I*N*N*E*R****W*I*N*N*E*R***W*I*N*N*E*R***""" ) else: print( """\n\n\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nKing Gorgish exlaims; Peasant! You have answered incorrectly for a third time!"\nGorgish quickly uses his orb to transport himself out of the room and to safety.\nHe leaves you behind. The room shrinks to the size of an ant.\nYou have been smashed into oblivion.\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX""" ) else: print("Try again") room4() else: print("Try Again") room4() else: print("Try again") room4()
def print_intro(): print(x) enter(c)
def code_ctrlr(_first_word=None, words=None, _sentence=None): if not _first_word or not words or not _sentence: raise ValueError("_first_word and _sentence can't None") _first_word = _first_word.lower() # todo: content awareness (knowing what variable names have just been used) # => higher priority to LRU variable names if _first_word == "if": op, op1, op2 = "", "", "" if "in" in words: op1 = "is" if "is" in words else "in" # todo: improve this op2 = "in" op = "in" elif "equals" in words: if "is" in words: # todo: improve this op1 = "is" elif "equal" in words: op1 = "equal" elif "equals" in words: op1 = "equals" op = "==" elif "less than equal" in _sentence: op1 = "is" if "is" in words else "less" # todo: improve this op2 = "to" op = "<=" elif "greater than equal" in _sentence: op1 = "is" if "is" in words else "greater" # todo: improve this op2 = "to" op = ">=" elif "greater than" in _sentence: op1 = "is" if "is" in words else "greater" # todo: improve this op2 = "than" op = ">" elif "less than" in _sentence: op1 = "is" if "is" in words else "less" # todo: improve this op2 = "than" op = "<" operand1_end = words.index(op1) operand2_start = words.index(op2) + 1 operand_1 = "_".join(words[1:operand1_end]) operand_2 = "_".join(words[operand2_start:]) text = f"if {operand_1} {op} {operand_2}:" copy(text) paste() enter() elif "equals" in words or "equal" in words: operand_1 = "_".join(words[1:operand1_end]) operand_2 = "_".join(words[operand2_start:]) op = "==" text = f"if {operand_1} {op} {operand_2}:" copy(text) paste() enter() elif _first_word == "print": text = "print" copy(text) paste() press('(') elif _first_word == "return": text = "" if words[1].lower() in ["true", "false"]: text = f"return {words[1][0].upper() + words[1][1:]}" else: text = _sentence copy(text) paste() return True elif _first_word == "raise": if "implemented" in words: copy("raise NotImplementedError('To be Implemented')") paste() return True else: print("didn't recognise the error to raise") return False elif _first_word == "for": text = "" if "range" in words: iterator_name = words[1] if len(words) > 1 else None if "to" in words: to_i = words.index("to") start = words[to_i - 1] end = words[to_i + 1] text = f"for {iterator_name} in range({start}, {end}):" else: range_i = words.index("range") if range_i + 1 < len(words): end = words[range_i + 1] text = f"for {iterator_name} in range({end}):" else: print("please mention the range-end for the loop") return False copy(text) paste() enter() return True