Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def story():
- room1Fr = {"test" : False}
- room1()
- def room1():
- """
- This is room-1
- """
- def riddle1():
- """
- Riddle of the first room
- """
- from random import randint
- print("\nThe lock on the door is activated by saying a number out loud!")
- correctAnswer = 1000
- randomCombination = 42
- while correctAnswer != randomCombination:
- correctAnswer1 = input("Try a number: ")
- if int(correctAnswer1) == randomCombination:
- print("Congratulations, you guess the correct number:", randomCombination)
- print("You have managed the open the door and get to the next room")
- break
- elif int(correctAnswer1) > randomCombination:
- print("The combination number is Lower")
- elif int(correctAnswer1) < randomCombination:
- print("The combination number is higher")
- else:
- print("Thats not a number, try again")
- def room1Clue():
- """
- Get clues on how to finish the room
- """
- print("1) Play the riddle game to move on to the next room")
- def room1Help():
- """
- Gives help commands for room 1
- """
- print("""You can use the commands:
- Riddle Gets the riddle of the room
- search <object> Search objects
- i/info Get information about the room
- bk/back Go Back
- fr/forward Go forward
- see Look around the room
- c/clue Get a clue\n""")
- gameMaster = "\nHello player I'm your gamemaster, you may call me Glados"
- roomLayout = '''\nWelcome to room-1, there is 2 objects in this room!\nThe room looks like this:
- """""""--"""""""
- " WC " "
- """""" "
- " "
- """"" "
- " B " "
- " E " "
- " D " "
- """"""""""""""""'''
- print(roomLayout, gameMaster)
- room1Answer = False
- choice = ""
- while room1Answer != True:
- choice = input("What would you like to do?: ")
- if choice == "riddle":
- riddle1()
- room1fr["test"] = True
- room1Answer = True
- elif choice == "i" or choice == "info":
- print(roomLayout)
- elif choice == "h" or choice == "help":
- room1Help()
- elif choice == "fr" or choice == "forward":
- if room1fr["test"] == True: # Det här funkar inte
- print("Moving up to room-2")
- room2()
- else:
- print("You need to finish this room first!")
- elif choice == "bk" or choice == "back":
- print("You're in the first room you cant go back!")
- elif choice == "see":
- print("You see a WC and a BED and a door, try searching the wc/bed!")
- elif choice == "c" or choice == "clue":
- room1Clue()
- elif "search" in choice:
- if "bed" in choice:
- print("\nYou searched the bed and found nothing\n")
- elif "wc" in choice:
- print("\nYou searched the WC and found a calculator")
- print("Added calculator to your backpack\n")
- else:
- print("You cant search that, try: search bed/search wc")
- else:
- print("Write h/help to get command list")
- Traceback (most recent call last):
- File "C:\cygwin64\dbwebb-kurser\python\me\kmom10\adventure\adventure.py", line 104, in <module>
- main()
- File "C:\cygwin64\dbwebb-kurser\python\me\kmom10\adventure\adventure.py", line 99, in main
- story()
- File "C:\cygwin64\dbwebb-kurser\python\me\kmom10\adventure\main.py", line 9, in story
- room1()
- File "C:\cygwin64\dbwebb-kurser\python\me\kmom10\adventure\main.py", line 79, in room1
- room1fr["test"] = True
- NameError: name 'room1fr' is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement