print("Use the following:\nw for west\ne for east\ns for south\nn for north\nne for northeast\nnw for northwest\nsw for southwest\nse for southeast\nkill *object* for killing the object\ntake *object* for taking object\nd for down\nu for up\n\n")
def fail():
    print("You can't do that.\n")
def finish():
    print("Congrats! You finished this mini Python text adventure!")
    credits()
def start():
    print("Outside mansion\nYou are in front of a huge mansion with 10-foot-tall double doors to your north. To your East, a pathway leads into the forest, holding many secrets.")
    answer = input("You: ")
    if answer == "n":
        hallway()
    elif answer == "e":
        waterfall()
    else:
        fail()
        start()
def hallway():
    print("Hallway\nOpening the double doors takes a large amount of strength. When they are opened, a dozen cobwebs glisten in the light from the open door. A door to your north and a door to your south are your only options.")
    answer = input("You: ")
    if answer == "n":
        chestroom()
    elif answer == "s":
        start()
    else:
        fail()
        hallway()
def chestroom():
    if "Key 1" not in inventory:
        print("Chest Room\nInside this room, a large chest holds pounds and pounds of gold, with a large key on top of the pile. A door to your south, north, and southeast appear openable.")
        answer = input("You: ")
        if answer == "s":
            hallway()
        elif answer == "se":
            summoning()
        elif answer == "n":
            diningroom()
        elif answer == "take key":
            print("Key taken.")
            inventory.append("Key 1")
            chestroom()
        else:
            fail()
            chestroom()
    else:
        print("Chest Room\nInside this room, a large chest holds pounds and pounds of gold. A door to your south, north, and southeast appear openable.")
        answer = input("You: ")
        if answer == "s":
            hallway()
        elif answer == "se":
            summoning()
        elif answer == "n":
            diningroom()
        elif answer == "take key":
            print("Key already taken.")
            chestroom()
        else:
            fail()
            chestroom()
def summoning():
    print("Summoning Area\nA large, triangular shaped room has altars in the centre, with lit candles providing light. A bubbling cauldron, boiling over a fire, has a green liquid in it, with bones sticking out. The smell is putrid. To your northwest, there is a door, as well as to your southeast and your northeast.")
    answer = input("You: ")
    if answer == "nw":
        chestroom()
    elif answer == "se":
        library()
    elif answer == "ne":
        armorroom()
    elif answer == "read book":
        print("You don't want to do that.")
        summoning()
    elif answer == "take book":
        print("It's way too heavy.")
        summoning()

    else:
        fail()
        summoning()
def library():
    print("Library\nA large library with oddly placed bookshelves provides silence. A book lies on a table, but it is far too heavy to pick up. On the book, letters spelling out 'How to Summon Demons' are clearly visible. An exit is to your northwest and your north.")
    answer = input("You: ")
    if answer == "nw":
        summoning()
    elif answer == "n":
        if "Key 1" in inventory:
            keyroom()
        else:
            print("The door is locked.")
            library()
    else:
        fail()
        library()
def keyroom():
    if "Key 2" not in inventory:
        print("Key Room\nA large key is sitting on a desk here. An exit is to your south.")
        answer = input("You: ")
        if answer == "take key":
            print("Key taken.")
            inventory.append("Key 2")
            keyroom()
        elif answer == "s":
            library()
        else:
            fail()
            keyroom()
    else:
        print("Key Room\nThere is a desk here. An exit is to your south.")
        answer = input("You: ")
        if answer == "take key":
            print("Key already taken.")
            keyroom()
        elif answer == "s":
            library()
        else:
            fail()
            keyroom()
def armorroom():
    print("Armor Room\nAn armor room with many different shields, chestplates, and helmets lies in your way. An exit is to your west, or your south.")
    answer = input("You: ")
    if answer == "s":
        summoning()
    elif answer == "w":
        chestroom()
    elif answer == "take armor":
        print("It's too heavy.")
        armorroom()
    else:
        fail()
        armorroom()
def diningroom():
    print("Dining Room\nA large dining room has a 30 foot long table in the center of it, with more than a dozen throne-like chairs. An exit is to your south, and a strange staircase leads down.")
    answer = input("You: ")
    if answer == "s":
        chestroom()
    elif answer == "d":
        dungeon()
    else:
        fail()
        diningroom()
def dungeon():
    if "Sword" not in inventory:
        print("Dungeon\nA huge dungeon lies under the dining room, with skeletons galore in several cells. No doubt once heroes, now they are long gone. A sword lies on the ground. A staircase leads up.")
        answer = input("You: ")
        if answer == "take sword":
            print("Sword taken.")
            inventory.append("Sword")
            dungeon()
        elif answer == "u":
            diningroom()
    else:
        print("Dungeon\nA huge dungeon lies under the dining room, with skeletons galore in several cells. No doubt once heroes, now they are long gone. A staircase leads up.")
        answer = input("You: ")
        if answer == "take sword":
            print("Sword already taken.")
            dungeon()
        elif answer == "u":
            diningroom()
def waterfall():
    print("Waterfall View\nA large waterfall lies here, with an ecosystem of flora and fauna. Down, there is a balcony, and west is a small passage to the haunted mansion.")
    answer = input("You: ")
    if answer == "d":
        balcony()
    elif answer == "w":
        start()
    else:
        fail()
        waterfall()
def balcony():
    print("Balcony\nYou are on the balcony. You can hear the waterfall even louder now. The only places to go are west, which is a large door, or up, to the waterfall view.")
    answer = input("You: ")
    if answer == "w":
        if "Key 2" in inventory:
            monster()
        else:
            print("The door is locked. You need a key.")
            balcony()
    elif answer == "u":
        waterfall()
    else:
        fail()
        balcony()
def monster():
    print("Treasure Room\n A huge monster towers over you, roaring as loud as he can. There is no running: you have to fight.")
    answer = input("You: ")
    if answer == "kill monster":
        if "Sword" in inventory:
            killedmonster()
        else:
            print("You have no sword to kill it with!")
            dead()
    else:
        print("You try, but the monster grabs you and kills you!")
        dead()
def killedmonster():
    print("Treasure Room\nYou stab the monster with your sword, and notice a huge bag of loot on the floor.")
    finish()
def dead():
    print("The monster killed you! The end.")
    exit()
def credits():
    print("Made by Rio Carter in 2025")
    print("Copyright (c) Rio Carter")
    print("Inspiration given from Zork: The Underground Empire.")
inventory = []
start()




                

