import random
rooms = {
'hall': {
'north':'kitchen',
'west':'living room',
'south':'corridor'
},
'kitchen': {
'south':'hall',
'west':'dining room',
'north': 'staircase'
},
'dining room': {
'east': 'kitchen',
'south': 'living room',
'north': 'bedroom'
},
'bedroom': {
'south': 'dining room',
'west': 'office',
'east': 'staircase'
},
'staircase': {
'west': 'bedroom',
'south': 'kitchen',
'up': 'staircase 2nd floor',
'upstairs': 'staircase 2nd floor',
'down': 'cellar',
'downstairs': 'cellar'
},
'staircase 2nd floor': {
'down': 'staircase',
'downstairs': 'staircase',
'up': 'glassroom',
'upstairs': 'glassroom',
'north': 'study',
'east': 'ball room',
'west': 'lounge'
},
'study': {
'south': 'staircase 2nd floor',
'monster': 'superhungry'
},
'ball room': {
'west': 'staircase 2nd floor',
'south': 'billard room'
},
'billard room': {
'north': 'ball room'
},
'lounge': {
'east': 'staircase 2nd floor',
'south': 'library'
},
'library': {
'north': 'lounge',
'monster': 'inlibrary'
},
'cellar': {
'up': 'staircase',
'upstairs': 'staircase',
'east': 'storage room'
},
'storage room': {
'west': 'cellar',
'south': 'secret cavern'
},
'secret cavern': {
'north': 'storage room'
},
'glassroom': {
'down': 'staircase 2nd floor',
'downstairs': 'staircase 2nd floor',
'east': 'attic'
},
'attic': {
'west': 'glassroom',
'south': 'secret passage',
'monster': 'monster'
},
'secret passage': {
'along': 'hall'
},
'office': {
'east': 'bedroom',
'north': 'solarium'
},
'solarium': {
'south': 'office'
},
'living room': {
'monster': 'monster',
'north': 'dining room',
'east':'hall',
'south': 'bathroom'
},
'bathroom': {
'north': 'living room',
'witch': 'witch',
'east':'corridor'
},
'corridor':{
'north':'hall',
'east':'garden',
'west':'bathroom'
},
'garden':{
'west': 'corridor',
'monster':'monster',
'south': 'drive'
},
'drive':{
'north': 'garden',
'south': 'street'
},
'street': {
'north': 'drive'
}
}
Map = '''
Map:
(if you can only see incoherent lines, try resizing your window. The image is an ascii artwork and text wrapping destroys its meaning.)
^
n
s
\/
Ground floor:
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| |
| |
| |
| |
| solarium |
| |
| |
| |
| |
| |
|________ ________|
|¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯||¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯||¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| || || |
| || || |
| || || |
| |
| office bedroom staircase |
| |
| |
| || || |
| || || |
| || || |
|_____________________||_______ _______||_______ ________|
|¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯||¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯|
| || |
| || |
| || |
| || |
| |
| Dining room Kitchen |
| |
| |
| || |
| || |
| || |
| || |
|_________ _________||________ _________|
|¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯||¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯|
| || |
| || |
| || |
| |
| |
| Living room Hall |
| |
| || |
| || |
| || |
| || |
| || |
|_______ _______||_______ _______|
|¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯||¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯|≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
| || | ∫
| || | ∫
| || | ∫
| || ∫
| ∫
| Bathroom Corridor Garden ∫
| ∫
| ∫
| || ∫
| || | ∫
| || | ∫
| || | ∫
|______________________||______________________|≈≈≈≈≈≈≈ ≈≈≈≈≈≈≈≈
∫ ∫
∫ ∫
∫ ∫
∫ ∫
∫ ∫
∫ ∫
∫ ∫
∫ drive ∫
∫ ∫
∫ ∫
∫ ∫
∫ ∫
∫ ∫
∫ ∫
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Street
3rd Floor:
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯||¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| || |
| || |
| || |
| |
| |
| Glassroom Attic |
| to staircase |
| |
| || |
| || |
| || |
| || |
|______________________________||___________ _______|
|¯¯¯ ¯¯¯¯¯¯|
| secret |
| passage |
| to |
| hall |
|____________|
2nd Floor:
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| |
| |
| |
| |
| |
| study |
| |
| |
| |
| |
| |
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯| | |
| | |_____ _________________|
| | | |
| | | |
| | | | |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| ||¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯|| |
| || || |
| || || |
| || || |
| || |
| Lounge |
| staircase |
| 2nd floor Ball Room |
| |
| || || |
| || || |
| || || |
| || || |
| ||_________________________|| |
| | | |
| | |____________ ______________|
|_______ ___________| |¯¯¯¯¯ ¯¯¯¯¯¯|
|¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| library | | Billard room |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
|______________________________| |_______________________|
Cellar:
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯||¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| || |
| || |
| || |
| |
| Cellar |
| to staircase storage room |
| |
| |
| || |
| || |
| || |
|______________________________||______ ___________|
|¯¯¯¯¯¯ ¯¯¯¯¯¯¯|
| secret |
| cavern |
|________________|
'''
currentroom = 'hall'
inventory=[]
moves = '\n'
possmoves = "\n"
if not 'play' in input('''
The Quest at Landsdown Manor
Type 'play' to play:
> ''').lower():
quit()
inventoryspace = 7
print('''
Thou findst thyself in the mansion of lost souls.
=======================
IMPORTANT! READING THIS TEXT AFFECTS YOUR CHANCES OF WINNING!
Your backpack is your inventory. It only has space for ''' + str(inventoryspace) + ''' items.
You can add and remove things from it, but some things get taken away during the game!
Your body stability is how weak your body is.
If you walk against a wall, your body stability decreases.
You must eat donuts or take a break in the solarium to get stronger (increase it again)!
You can go into a room with a monster in it… only you can never be sure that it isn't concealing something!
Also: If you are too weak to go somewhere, keep trying!
=======================
commands:
go [direction] (goes foward one room in direction)
get / take [item] (adds item to inventory)
leave [item] (removes item from inventory; leaves it in current room. Only works if room has no item in it already. It is unadvisable to leave an item in a room where you cannot retrieve it, such as a room with a monster in it or the cellar where you need a light to see.)
open [item] (opens something)
close [item] (closes something)
my moves (shows a list of your moves)
possible moves / pm (shows a list of moves you can make)
inventory (shows inventory)
use map (shows a map of the mansion; works only if you've got a map in your inventory.)
quit / exit (exits the game)
eat donut (eats a donut, increases your body stability by one)
=======================
-----------------------
''')
inventoryspace = 7
finished = False
HasSuperMonsterEaten = True
NumStoreDonuts = 0
IsFirstTimeInStorageRoom = False
IsReallyFirstTimeInStorageRoom = True
witchHasBroom = False
AllDoorsClosed = True
firstTimeGarden = True
waslastmovesolarium = False
isfirstcommand = True
def Quit():
if 'yes' in input('You will lose all levels and achievements if you quit. Do you still want to continue? Type yes to leave, no to stay.\n> ').lower():
print('\nExiting…')
quit()
def Skip():
if 'yes' in input('Are you sure you want to skip this level? Type yes to leave, no to stay. Warning: in skipping this level, you may not learn some important knowledge.\n> ').lower():
global finished
finished = True
def isAn(text):
return text.startswith('a') or text.startswith('e') or text.startswith('i') or text.startswith('o') or text.startswith('u')
def removeAllDonuts():
global inventory
z=0
for i in inventory:
if i=='donut':
z+=1
for i in range(z):
inventory.remove('donut')
def status():
global currentroom
global rooms
global inventory
global moves
global possmoves
global IsFirstTimeInStorageRoom
global waslastmovesolarium
global isfirstcommand
if 'witch' in inventory and 'witch' in rooms['bathroom']:
rooms['bathroom'].pop('witch')
if currentroom == "solarium" and not waslastmovesolarium:
global bodystability
if bodystability < 10:
bodystability = 10
print(f"Ahhh, the view from those windows! Perfect! You relax. Your nerves calm down. Your bodystability is now 10.")
waslastmovesolarium = True
if currentroom is not "solarium":
waslastmovesolarium = False
print(f'\nyou are in the {str(currentroom)}.\nBody stability: {bodystability}\nInventory: {str(inventory)}')
w = False
try:
if rooms[currentroom]['monster'] == 'monster' or rooms[currentroom]['monster'] == 'superhungry' or rooms[currentroom]['monster'] == 'inlibrary':
w = True
except:
pass
if currentroom == 'storage room' and 'torch' in inventory:
if not IsFirstTimeInStorageRoom:
print('Ah, back again for more donuts?')
IsFirstTimeInStorageRoom=True
try:
if 'items' in rooms[currentroom] and not (currentroom == 'study') and not w:
for item in rooms[currentroom]['items']:
print('you can see a '+str(item['name'])+'.')
print('the '+ str(item['name']) +' is '+str(item['state'])+'.')
if 'items' in rooms[currentroom] and currentroom == 'study':
global HasSuperMonsterEaten
for item in rooms[currentroom]['items']:
try:
if rooms['study']['monster'] == 'superhungry':
print('you can see an EXTREMELY hungry monster, sitting on a desk. The desk has one drawer. Type \'talk\' to talk with it…')
elif HasSuperMonsterEaten:
HasSuperMonsterEaten = False
print('The monster eats the soufflé and your donuts and goes to sleep in a corner. The drawer in the desk is '+str(item['state'])+'.')
else:
print('The drawer in the desk is '+str(item['state'])+'.')
except:
pass
try:
if 'item' in rooms[currentroom].keys() and not (((not 'torch' in inventory and not 'torch' in rooms[currentroom]['item']) and not emergencymatch)and (currentroom=='cellar' or currentroom=='storage room' or currentroom=='secret cavern')) and not currentroom=='kitchen' and not currentroom=='storage room' and not currentroom == 'bathroom' and not w:
if isAn(str(rooms[currentroom]['item'])):
print('you can see an '+str(rooms[currentroom]['item']))
else:
print('you can see a '+str(rooms[currentroom]['item']))
except:
pass
if 'item' in rooms[currentroom] and currentroom == 'kitchen':
if rooms[currentroom]['item'] == 'donut':
print('you can see a box of '+str(rooms[currentroom]['item'])+'s, but there\'s only one left.')
else:
if isAn(str(rooms[currentroom]['item'])):
print('you can see an '+str(rooms[currentroom]['item']))
else:
print('you can see a '+str(rooms[currentroom]['item']))
global NumStoreDonuts
if 'item' in rooms[currentroom] and currentroom == 'storage room' and ('torch' in inventory or emergencymatch):
if NumStoreDonuts==0:
print('you can see a huge supply of '+str(rooms[currentroom]['item'])+'s. Want to take one?')
else:
print('you can see a huge supply of '+str(rooms[currentroom]['item'])+'s. Do you think '+str(NumStoreDonuts)+' is enough?')
if 'item' in rooms[currentroom] and currentroom == 'bathroom':
print('you can see a witch. You can type \'talk\' to talk with her…')
except:
pass
if 'monster' in rooms[currentroom]:
if (rooms[currentroom]['monster'] == 'inlibrary' or rooms[currentroom]['monster'] == 'monster'):
print('There\'s a hungry monster in front of you. Type \'talk\' to talk with it…')
if (rooms[currentroom]['monster'] == 'satisfied'):
print('There\'s a satisfied monster in front of you. Type \'talk\' to talk with it…')
if (currentroom=='cellar' or currentroom=='storage room' or currentroom=='secret cavern') and not 'torch' in inventory and not emergencymatch:
torch = False
if 'item' in rooms[currentroom]:
if rooms[currentroom]['item'] == 'torch':
torch = True
if not torch:
print('You need a light to see in the cellar.')
for value in rooms[currentroom].values():
try:
x = ''
if rooms[value]['monster'] == 'monster' or rooms[value]['monster'] == 'inlibrary' or rooms[value]['monster'] == 'superhungry':
for i in rooms[currentroom]:
if rooms[currentroom][i] == str(value):
x = i
print('You can hear a hungry monster '+str(x)+'.')
except:
pass
try:
global monsterSpeak
if rooms[currentroom]['monster'] == 'monster' and 'donut' in inventory:
inventory.remove('donut')
print('the monster has eaten your donut.')
monsterSpeak = 'Miam, miam, miam!'
rooms[currentroom]['monster'] = 'satisfied'
if (rooms[currentroom]['monster'] == 'monster' or rooms[currentroom]['monster'] == 'inlibrary' or rooms[currentroom]['monster'] == 'superhungry') and not ('donut' in inventory):
monsterSpeak = 'grrrrrrr!'
if rooms[currentroom]['monster'] == 'satisfied' or rooms[currentroom]['monster'] == 'finally satisfied':
monsterSpeak = 'Mmmmmmmm! That was delicious!'
if rooms[currentroom]['monster'] == 'inlibrary' and 'donut' in inventory:
removeAllDonuts()
print('the monster has eaten your donuts. It seems to offer you a soufflé-aux-épinards…')
monsterSpeak = 'Miam, miam, miam!'
rooms[currentroom]['monster'] = 'satisfied'
if len(inventory) == inventoryspace:
print('\nYour inventory is full. Leave some of the items to make room for new ones.')
#elif rooms[currentroom]['monster'] == 'inlibrary' and not ('donut' in inventory):
# monsterSpeak = 'grrrrrrr!'
except:
pass
for value in rooms[currentroom].values():
try:
x = ''
if rooms[value]['witch'] == 'witch' and not 'witch' in inventory:
for i in rooms[currentroom]:
if rooms[currentroom][i] == str(value):
x = i
print('You can hear a witch wimpering '+str(x)+'.')
except:
pass
if isfirstcommand:
print('\nHint: type \'pm\' (stands for \'possible moves\') to see what moves you can make in this particular room. You can type this anytime.')
isfirstcommand = False
try:
global witchSpeak
global witchHasBroom
if rooms[currentroom]['witch']== 'witch' and ('broom' in inventory or witchHasBroom):
inventory.remove('broom')
witchHasBroom = True
witchSpeak = {'first': "Oh! I thank you deary, for bringing me my broome. Canst thee save me, a humble witch, from the fearful creatures of timeless age, who restlessly haunt this dreaded mansion?", 'ifyes': "I thank thee, thou goode angel. I do think it be true, that magic helpe has brought thee to me! Please, take me with you.", 'ifno': 'Artst thou sure thou canst not help me? I am a poor, humble witche, ande wille do no harme to no-one.'}
elif rooms[currentroom]['witch']== 'witch' and not ('broom' in inventory):
witchSpeak = {'first': "Oh deary deary me, canst thou get me my broome?"}
except:
pass
if currentroom == 'study' and rooms['study']['monster'] == 'superhungry':
if 'soufflé-aux-épinards' in inventory and 'donut' in inventory:
rooms['study']['monster'] = 'finally satisfied'
inventory.remove('soufflé-aux-épinards')
removeAllDonuts()
#Quest 1: Escape Mansion
#setting the items:
rooms['hall']['item'] = 'umbrella'
rooms['ball room']['item'] = 'necklace'
rooms['billard room']['item'] = 'broom'
rooms['library']['item'] = 'soufflé-aux-épinards'
rooms['storage room']['item'] = 'donut'
rooms['secret cavern']['item'] = 'map'
rooms['glassroom']['item'] = 'vase'
rooms['attic']['items'] = [{'name': 'trunk', 'commands': {'open': 'open', 'close': 'closed'}, 'state': 'closed', 'ifopen': """
if not 'spiderweb' in inventory:
rooms['attic']['item'] = 'spiderweb'
""", 'ifclosed': "del rooms['attic']['item']"}]
rooms['study']['items'] = [{'name': 'drawer', 'commands': {'open': 'open', 'close': 'closed'}, 'state': 'closed', 'ifopen': """
if not 'key' in inventory and not rooms[currentroom]['monster'] == 'superhungry':
rooms['study']['item'] = 'key'
elif rooms[currentroom]['monster'] == 'superhungry':
print('you cannot open the drawer, because the monster is sitting on it.')
""", 'ifclosed': "del rooms['study']['item']"}]
rooms['solarium']['items'] = [{'name': 'cupboard', 'commands': {'open': 'open', 'close': 'closed'}, 'state': 'closed', 'ifopen': """
if not 'torch' in inventory:
rooms['solarium']['item'] = 'torch'
""", 'ifclosed': """
del rooms['solarium']['item']
"""}]
rooms['bathroom']['item'] = 'witch'
rooms['kitchen']['item'] = 'donut'
witchSpeak = {'first': "Canst thou get me my broome?"}
monsterSpeak = 'grrrrrrr!'
bodystability = 10
stabilityReactions = ["You stumble at every step. Your nerves are frayed. You must eat to calm your nerves.",
"You cannot go up stairs anymore, you fall down after each step. You must eat to calm down.",
"You are having difficulty getting up stairs. Every fall injures you. Eat something before things get worse.",
"You have a big headache. Your body feels sore and stiff. Maybe, you could go to the solarium and look outside to feel better.",
"Your head hurts. Your body aches. You begin to stumble. Be careful where you tread!",
"You begin to have a slight headache. A little inconvenience. Watch your step.",
"You are surprised: that came suddenly. You curse the walls a bit and move on.",
"Your muffled cursing is silent. Nobody hears it. You go on.",
"You blink a couple of times and go on. It's all right.",
"Ouch! That hurts."]
emergencymatch = False
while True:
error = True
if ((bodystability == 0 or bodystability == 1) and (currentroom == "glassroom" or currentroom == "staircase 2nd floor" or currentroom == "staircase")) or bodystability == 2 and (currentroom == "glassroom" or currentroom == "staircase 2nd floor" or currentroom == "staircase") and random.randint(0, 1) == 0:
currentroom = "cellar"
print("\nYou are weak; you fell down the stairs.")
if (bodystability == 0 or bodystability == 1) and not "torch" in inventory and not "match" in inventory:
print("\nYou find a match in your pocket. Your arm hurts painfully as you strike it on the sole of your shoe. It gives a dim light.")
emergencymatch = True
inventory.append('match')
status()
x = input('\n> ').lower()
w = False
try:
if rooms[currentroom]['monster'] == 'monster' or rooms[currentroom]['monster'] == 'superhungry' or rooms[currentroom]['monster'] == 'inlibrary':
w = True
except:
pass
if 'go' in x:
error = False
moves+=str(x)+'\n'
y = x.split(' ')
try:
if (bodystability == 0 or bodystability == 1) and (currentroom == "glassroom" or currentroom == "staircase 2nd floor" or currentroom == "staircase"):
currentroom == cellar
if not (currentroom == 'corridor' and y[1] == 'east' and (not 'key' in inventory)):
if not bodystability == 0 and not (bodystability==1 and y[1] == "up"):
currentroom = rooms[currentroom][y[1]]
elif bodystability == 1 and random.randint(0, 1) == 0:
print("\nYou are too weak to climb the stairs.")
else:
if random.randint(0, 1) == 0:
print("\nYou are too weak: You stumble, and fall on the floor.")
else:
currentroom = rooms[currentroom][y[1]]
print("\nYou made it… barely. Be careful!")
else:
print('You need the key to open the door to the garden.')
except:
if ("north" in str(y[1])) or ("west" in str(y[1])) or ("east" in str(y[1])) or ("south" in str(y[1])) or ("up" in str(y[1])) or ("down" in str(y[1])) or ("along" in str(y[1])):
print('\nYou have walked against a wall. You should use the function \'pm\' more. It shows the moves you can make.')
if bodystability == 0:
print("\n", stabilityReactions[0])
else:
print("\n", stabilityReactions[bodystability - 1])
if bodystability > 0:
bodystability -= 1
print(f"Your body stability is now {str(bodystability)}. ")
else:
print("\nYou should check your spelling more, you know.")
if x == "eat donut":
error = False
if 'donut' in inventory:
if bodystability < 10:
inventory.remove("donut")
bodystability += 1
print("\nYour nerves calm down as you eat a donut. You are feeling better now.")
print(f"\nYour body stability is now {bodystability}.")
else:
print('\nYour body stability is high. You should save your donut for later.')
if input('\nDo you still want to continue? Type yes or no.\n> ') == 'yes':
inventory.remove("donut")
print("\nYour nerves calm down as you eat a donut. You are feeling better now.")
else:
print("\nYou don't have a donut!")
if 'leave' in x and not inventory == []:
error = False
if 'item' in rooms[currentroom]:
print('\nYou cannot leave an item in a room that already has one.')
else:
try:
moves+=str(x)+'\n'
y = x.split(' ')
if y[1] in inventory:
inventory.remove(y[1])
rooms[currentroom]['item'] = y[1]
else:
print(f'You do not have the {y[1]} in your inventory.')
except:
error=True
try:
if ('get' in x or 'take' in x) and not ((x.split(' ')[1] == 'witch' and not witchHasBroom)):
error = False
moves+=str(x)+'\n'
y = x.split(' ')
def ifError():
if currentroom == 'kitchen' and 'item' in rooms[currentroom]:
print('This doesn\'t work. Do you want to take the donut? Just type: take donut.')
else:
global error
try:
print(str(y[1])+' can\'t be got.')
except:
error = True
try:
if not ((currentroom=='cellar' or currentroom=='storage room' or currentroom=='secret cavern') and ((not 'torch' in inventory and not rooms[currentroom]['item'] == 'torch') and not emergencymatch)):
if len(inventory) < inventoryspace:
if rooms[currentroom]['item'] == y[1]:
inventory.append(y[1])
if y[1] == 'torch':
print('you have got the '+str(y[1])+'. It makes a bright light.')
elif y[1] == 'map':
print('you have got the '+str(y[1])+'. It would be a good idea to use it…')
else:
print('you have got the '+str(y[1])+'.')
if currentroom == 'storage room':
if emergencymatch == True:
emergencymatch = False
print("Your match flickers out. You are in darkness once more.")
inventory.remove('match')
if not currentroom == 'storage room':
del rooms[currentroom]['item']
else:
ifError()
else:
print('\nYour inventory is full.')
else:
ifError()
except:
ifError()
except:
pass
if 'items' in rooms[currentroom] and not w:
y = -1
for item in rooms[currentroom]['items']:
y+=1
try:
if x.split(' ')[0] in item['commands'] and x.split(' ')[1] == item['name']:
error = False
moves+=str(x)+'\n'
rooms[currentroom]['items'][y]['state'] = item['commands'][x.split(' ')[0]]
for i in item:
if 'if' in i:
if 'if' + rooms[currentroom]['items'][y]['state'] in i:
exec(rooms[currentroom]['items'][y]['if'+rooms[currentroom]['items'][y]['state']])
except:
pass
if 'talk' in x:
error = False
if 'witch' in rooms[currentroom]:
print('The witch says:')
print(witchSpeak['first'])
z=False
for i in witchSpeak:
if 'if' in i:
z = True
while z:
y = input('\nAnswer the witch:\n> ').lower()
for i in witchSpeak:
if 'if' in i:
if i.split('if')[1] in y:
y=i.split('if')[1]
print(witchSpeak['if'+y])
if not '?' in witchSpeak['if'+y]:
z=False
break
if 'monster' in rooms[currentroom]:
print('The monster says:')
print(monsterSpeak)
if x == 'exit':
error = False
Quit()
if x == 'quit':
error = False
Quit()
if 'skip' in x:
error = False
Skip()
if (x == 'get witch' or x == 'take witch') and not witchHasBroom:
print('The witch says:\nOh deary, I will not goe anywherey without my broome!')
error = False
if (x == 'get donut' or x=='take donut') and currentroom == 'storage room':
NumStoreDonuts+=1
if currentroom != 'storage room':
IsFirstTimeInStorageRoom=False
NumStoreDonuts=0
if IsReallyFirstTimeInStorageRoom:
IsFirstTimeInStorageRoom = True
if currentroom == 'storage room':
IsReallyFirstTimeInStorageRoom = False
if currentroom == 'garden' and 'spiderweb' in inventory and firstTimeGarden:
print('the monster says:\nHey, that spiderweb looks very nice on you.')
firstTimeGarden = False
"""
if x.split(' ')[0] == 'fly':
currentroom = x.split(' ')[1]
if x.split(' ')[0] == 'add':
inventory.append(x.split(' ')[1])
#"""
if 'inventory' in x:
error = False
print('Inventory: '+str(inventory))
if 'my moves' in x:
error = False
print('Moves: '+str(moves))
if 'possible moves' in x or 'pm' in x:
error = False
u = rooms[currentroom]
v = "\n"
for i in u:
if i=='north' or i=='south' or i=='west' or i=='east' or i=='up' or i=='down' or i=='along':
v += 'go '+i+' to the '+u[i]+'\n'
if i=='item' and not ((currentroom=='storage room' or currentroom=='cellar' or currentroom=='secret cavern') and not 'torch' in inventory) and not w:
v += 'get '+u[i]+'\n'
if i=='items' and not w:
for item in rooms[currentroom][i]:
for command in item.get('commands'):
v += str(command) + ' ' + str(item['name']) + '\n'
print('possible moves: '+str(v))
if x == 'use map':
if 'map' in inventory:
error = False
print(Map)
else:
print('You can only use the map if it is in your inventory.')
error = False
if x=='':
error = False
pass
if error:
print('\nError: no command \''+str(x)+'\'.')
print('---------------------------')
AllDoorsClosed = True
for room in rooms:
for i in rooms[room]:
if i == 'items':
for y in rooms[room][i]:
if y['state'] == 'open':
AllDoorsClosed = False
if currentroom == 'street' and 'witch' in inventory:
if AllDoorsClosed:
print('\nyou are in the street.\nInventory: '+str(inventory)+'''
The witch thanks you for saving her, and hands you a note.
The note reads:
I, senior witch, herebye excuse this soul fore missinge a day at schoole,
on groundes offe saving the daye.
=================================================================
Congratulations, you have completed the game!
=================================================================
=================================================================
''')
break
else:
print('\nyou are in the street.\nInventory: '+str(inventory)+'''
The witch thanks you for saving her. But she says: "Oh deary, we lefte the place a messe! Nexte time we shoulde remember to close all the drawers and cupboards we opened."
The witch then hands you a note.
The note reads:
I, senior witch, herebye excuse this soul fore missinge a day at schoole,
on groundes offe saving the daye.
=================================================================
Congratulations, you have completed the game!
=================================================================
=================================================================
''')
break
if finished:
break
for room in rooms:
if 'item' in rooms[room]:
del rooms[room]['item']
if 'items' in rooms[room]:
del rooms[room]['items']