Esempio n. 1
0
def handleBlueCorridor2(userInput, state):
    if userInput == 'GO NORTH':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_3',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_3',
                             userInput) and handleRustyKeyPickup(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_3', userInput)
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_1',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_1',
                             userInput) and handleRustyKeyPickupCorridor1(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_1', userInput)
    elif userInput == 'GO WEST' or userInput == 'GO SOUTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 2
0
def handleLivingRoom(userInput, state):
    if 'THROW' in userInput:
        return redPuzzle(state, userInput)
    elif userInput == 'TAKE RED KEY' or userInput == 'TAKE KEY' and 'carKeys' in state[
            'isBurned']:
        return state['inventory'].pop('greyKey') and state['inventory'].pop(
            'ladder') and returnToMainHall(state, 'redKey',
                                           'MAIN_HALL_RETURN_FROM_RED')
    elif userInput == 'GO EAST':
        if 'photograph' in state['inventory']:
            return goToLevel(state, 'KITCHEN',
                             userInput) and handleNewKitchenDesc(
                                 state, userInput)
        else:
            return goToLevel(state, 'KITCHEN', userInput)
    elif userInput == 'GO WEST':
        if 'carKeys' in state['inventory']:
            return goToLevel(state, 'HALL', userInput) and handleNewHallDesc(
                state, userInput)
        else:
            return goToLevel(state, 'HALL', userInput)
    elif userInput == 'GO NORTH' or userInput == 'GO SOUTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 3
0
def handleBlueCorridor1(userInput, state):
    if userInput == 'GO SOUTH':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_START', userInput)
        else:
            return goToLevel(state, 'BLUE_START',
                             userInput) and handleTrueTorchLevel(
                                 state, userInput)
    elif userInput == 'GO WEST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_2',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_2', userInput)
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_5',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_5', userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_5',
                             userInput) and handleRustyKeyPickupCorridor5(
                                 state, userInput)
    elif userInput == 'GO NORTH':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_4',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_4', userInput)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 4
0
def handleBlueCorridor6(userInput, state):
    if userInput == 'GO SOUTH':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_5',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_5', userInput)
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_7',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_7', userInput)
    elif userInput == 'GO NORTH':
        if "rustyKey" in state['inventory']:
            if state['inventory']['rustyKey']['itemUse'] == True:
                return goToLevel(state, 'BLUE_CORRIDOR_8', userInput)
            else:
                return handleDoorLock(state, 'BLUE_CORRIDOR_6', userInput)
        else:
            return handleDoorLock(state, 'BLUE_CORRIDOR_6', userInput)
    elif userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 5
0
def handleBlueCorridor3(userInput, state):
    if userInput == 'GO SOUTH':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_2',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_2',
                             userInput) and handleRustyKeyPickupCorridor2(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_2', userInput)
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_4',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        elif 'rustyKey' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_4', userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_4',
                             userInput) and handleRustyKeyPickupCorridor4(
                                 state, userInput)
    elif userInput == "TAKE RUSTY KEY" or userInput == "TAKE KEY":
        return takeItem(state, 'rustyKey') and handleRustyKeyPickup(
            state, userInput)
    elif userInput == 'GO WEST' or userInput == 'GO NORTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 6
0
def handleUpperFloor(userInput, state):
    if userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if 'carKeys' in state['inventory']:
            return goToLevel(state, 'HALL', userInput) and handleNewHallDesc(
                state, userInput)
        else:
            return goToLevel(state, 'HALL', userInput)
    elif userInput == 'USE GREY KEY' or userInput == 'USE KEY' and "greyKey" in state[
            "inventory"]:
        return handlePersistantItems(state, "GREY KEY", 'BEDROOM')
    elif userInput == 'GO WEST':
        if 'GREY KEY' in state['usedItems']:
            if 'canvas' in state['inventory']:
                return goToLevel(state, 'BEDROOM',
                                 userInput) and handleNewBedroomDesc(
                                     state, userInput)
            else:
                return goToLevel(state, 'BEDROOM', userInput)
        else:
            return handleDoorLock(state, 'UPPER_FLOOR_W', userInput)
    elif userInput == 'USE LADDER' and "ladder" in state["inventory"]:
        if 'greyKey' in state['inventory']:
            return goToLevel(state, 'ATTIC', userInput) and handleNewAtticDesc(
                state, userInput)
        else:
            return goToLevel(state, 'ATTIC', userInput)
    elif userInput == 'GO NORTH':
        return handleDoorLock(state, 'UPPER_FLOOR_N', userInput)
    elif userInput == 'GO EAST' or userInput == 'GO SOUTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 7
0
def handleMirrorRoom1(userInput, state):
    if userInput == "GO EAST":
        return goToLevel(state, 'MIRROR_ROOM_2', userInput)
    elif userInput == "GO SOUTH" or userInput == "GO WEST" or userInput == "GO NORTH":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 8
0
def handleOutside(userInput, state):
    if userInput == 'GO WEST':
        if "lightswitch" in state['usedItems'] and "brassKey" in state['inventory']:
            return goToLevel(state, 'GREENHOUSE', userInput) and handleKeyTakeGreenhouse(state)
        elif "lightswitch" in state['usedItems']:
            return goToLevel(state, 'GREENHOUSE', userInput) and handleLightGreenhouse(state)
        else:
            return goToLevel(state, 'GREENHOUSE', userInput)
    elif userInput == 'LICK DOOR':
        return goToLevel(state, 'MAIN_HALL', userInput)
    elif userInput == 'LOOK NICE':
        return goToLevel(state, 'MIRROR_ROOM_1', userInput)
    elif userInput == 'MR JALS':
        return goToLevel(state, 'SADNESS_1', userInput)
    elif userInput == 'PET THE BABY':
        return goToLevel(state, 'CRIB_ROOM', userInput)
    elif userInput == 'GO NOWHERE':
        return goToLevel(state, 'NOWHERE', userInput)
    elif userInput == 'SMASH':
        return goToLevel(state, 'LIVING_ROOM', userInput)
    elif userInput == 'HAVE A NICE DAY':
        return goToLevel(state, 'BEACH', userInput)
    elif userInput == 'ABSOLUTE LEGEND':
        return goToLevel(state, 'MAIN_HALL_ALL_KEYS', userInput)
    elif userInput == 'TAKE A SAD SHOWER':
        return goToLevel(state, 'BLUE_START', userInput)
    elif userInput == 'GO NORTH':
        return goToLevel(state, 'PORCH', userInput)
    elif userInput == 'GO SOUTH' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 9
0
def handleLighthouseOutside(userInput, state):
    if userInput == 'GO NORTH':
        return goToLevel(state, 'LIGHTHOUSE', userInput)
    elif userInput == "GO SOUTH":
        return goToLevel(state, "GATE", userInput)
    elif userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 10
0
def handleBlueFinish(userInput, state):
    if userInput == 'TAKE BLUE KEY' or userInput == 'TAKE KEY':
        return state['inventory'].pop('torch') and state['inventory'].pop(
            'rustyKey') and returnToMainHall(state, 'blueKey',
                                             'MAIN_HALL_ALL_KEYS')
    elif userInput == 'GO WEST' or userInput == 'GO NORTH' or userInput == 'GO EAST' or userInput == 'GO SOUTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 11
0
def handleLighthouse(userInput, state):
    if userInput == 'GO WEST' or userInput == 'GO EAST' or userInput == 'GO NORTH':
        return handleInvalidDirection(state)
    elif userInput == "GO SOUTH":
        return goToLevel(state, "LIGHTHOUSE_OUTSIDE", userInput)
    elif userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        return goToLevel(state, "LIGHTHOUSE_TOP_FLOOR", userInput)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 12
0
def handleLove(userInput, state):
    if userInput == "GO NORTH":
        return goToLevel(state, 'SADNESS_1', userInput)
    elif userInput == "GO WEST":
        return goToLevel(state, 'ANGER_2', userInput)
    elif userInput == "GO SOUTH" or userInput == "GO EAST":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 13
0
def handleSadness2(userInput, state):
    if userInput == 'TAKE POCKET WATCH' or userInput == 'TAKE WATCH':
        return goToLevel(state, "END", userInput)
    elif userInput == "GO EAST":
        return goToLevel(state, 'SADNESS_1', userInput)
    elif userInput == "GO WEST" or userInput == "GO NORTH":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 14
0
def handleSadness1(userInput, state):
    if userInput == "GO WEST":
        return goToLevel(state, 'SADNESS_2', userInput)
    elif userInput == "GO SOUTH":
        return goToLevel(state, 'LOVE', userInput)
    elif userInput == "GO EAST" or userInput == "GO NORTH":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 15
0
def handleAnger2(userInput, state):
    if userInput == "GO EAST":
        return goToLevel(state, 'LOVE', userInput)
    elif userInput == "GO SOUTH":
        return goToLevel(state, 'ANGER_1', userInput)
    elif userInput == "GO WEST" or userInput == "GO NORTH":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 16
0
def handleJoy(userInput, state):
    if userInput == "GO WEST":
        return goToLevel(state, 'ANGER_1', userInput)
    elif userInput == "GO SOUTH":
        return goToLevel(state, 'MIRROR_ROOM_2', userInput)
    elif userInput == "NORTH" or userInput == "GO EAST":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 17
0
def handleCaptainsCabin(userInput, state):
    if userInput == 'GO WEST':
        return goToLevel(state, 'SHIPWRECK', userInput) and handleNewShipwreckDesc(state, userInput)
    elif userInput == "GO EAST" or userInput == "GO NORTH" or userInput == "GO SOUTH":
        return handleInvalidDirection(state)
    elif userInput == "TAKE TORN PAGES" or userInput == "TAKE PAGES":
        return takeItem(state, "tornPages")
    elif userInput == "TAKE FAMILY PHOTOGRAPH" or userInput == "TAKE PHOTOGRAPH" or userInput == "TAKE FAMILY PHOTO" or userInput == "TAKE FRAMED FAMILY PHOTOGRAPH":
        return handleInvalidPhoto(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 18
0
def handlePorch(userInput, state):
    if userInput == 'GO SOUTH':
        return goToLevel(state, 'OUTSIDE', userInput)
    elif userInput == 'USE BRASS KEY' or userInput == 'USE KEY' and "brassKey" in state["inventory"]:
        return state['inventory'].pop('brassKey') and goToLevel(state, 'MAIN_HALL', userInput) 
    elif userInput == 'GO NORTH':
        return handleDoorLock(state, 'PORCH', userInput)
    elif userInput == 'GO EAST' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 19
0
def handleShipwreck(userInput, state):
    if userInput == 'GO WEST':
        return goToLevel(state, 'BEACH_EAST_SIDE', userInput)
    elif userInput == "GO EAST":
        if "tornPages" in state["inventory"]:
            return goToLevel(state, 'CAPTAINS_CABIN', userInput) and handleNewCabinDesc(state, userInput)
        else:
            return goToLevel(state, "CAPTAINS_CABIN", userInput)
    elif userInput == 'GO NORTH' or userInput == "GO SOUTH":
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 20
0
def handleBeachEastSide(userInput, state):
    if userInput == 'GO WEST':
        return goToLevel(state, 'BEACH', userInput) and handleNewBeachDesc(state, userInput)
    elif userInput == 'GO EAST':
        if "tornPages" in state["inventory"]:
            return goToLevel(state, 'SHIPWRECK', userInput) and handleNewShipwreckDesc(state, userInput)
        else:
            return goToLevel(state, "SHIPWRECK", userInput)
    elif userInput == 'GO SOUTH' or userInput == 'GO NORTH':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 21
0
def handleShedFrontDoor(userInput, state):
    if userInput == 'GO WEST':
        if "oilLamp" in state["inventory"]:
            return goToLevel(state, "SHED", userInput) and handleNewShedDesc(state, userInput)
        else:
            return goToLevel(state, "SHED", userInput)
    elif userInput == 'GO NORTH' or userInput == "GO SOUTH":
        return handleInvalidDirection(state)
    elif userInput == 'GO EAST':
        return goToLevel(state, "BEACH", userInput) and handleNewBeachDesc(state, userInput)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 22
0
def handleAttic(userInput, state):
    if userInput == 'GO SOUTH':
        return handleDoorLock(state, 'ATTIC', userInput)
    elif userInput == 'USE LADDER' and "ladder" in state["inventory"]:
        return goToLevel(state, 'UPPER_FLOOR', userInput)
    elif userInput == 'TAKE GREY KEY' or userInput == 'TAKE KEY':
        return takeItem(state, 'greyKey')
    elif userInput == 'TAKE BOX' or userInput == 'TAKE BOXES':
        return handleInvalidBox(state)
    elif userInput == 'GO NORTH' or userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 23
0
def handleLighthouseTopFloor(userInput, state):
    global gateCalled
    global shedCalled
    if userInput == 'GO NORTH' or userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    elif userInput == "TAKE STAIRS" or userInput == 'USE STAIRS':
        return goToLevel(state, "LIGHTHOUSE", userInput)
    elif userInput == 'TAKE GREEN KEY' or userInput == 'TAKE KEY':
        gateCalled = gateCalled - 1
        shedCalled = shedCalled - 1
        return state['inventory'].pop('oilLamp') and state['inventory'].pop('bronzeKey') and state['inventory'].pop('tornPages') and returnToMainHall(state, 'greenKey', 'MAIN_HALL_RETURN_FROM_GREEN')
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 24
0
def handleTorchRoom(userInput, state):
    if userInput == "TAKE TORCH":
        return takeItem(state, 'torch')
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_START', userInput)
        else:
            return goToLevel(state, 'BLUE_START',
                             userInput) and handleTrueTorchLevel(
                                 state, userInput)
    elif userInput == 'GO NORTH' or userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 25
0
def handleBeach(userInput, state):
    if userInput == 'GO WEST':
        if "oilLamp" in state["inventory"]:
            return goToLevel(state, "SHED_FRONT_DOOR", userInput) and handleNewShedFrontDoorDesc(state, userInput)
        else:
            return goToLevel(state, "SHED_FRONT_DOOR", userInput)
    elif userInput == 'GO NORTH':
        return goToLevel(state, 'GATE', userInput)
    elif userInput == 'GO SOUTH':
        return handleOcean(state)
    elif userInput == 'GO EAST':
        return goToLevel(state, "BEACH_EAST_SIDE", userInput)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 26
0
def handleBlueCorridor9(userInput, state):
    if userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    elif userInput == 'GO NORTH':
        return goToLevel(state, 'BLUE_FINISH', userInput)
    elif userInput == 'GO EAST':
        if 'torch' not in state['inventory']:
            return goToLevel(state, 'BLUE_CORRIDOR_8',
                             userInput) and handleFalseTorchLevel(
                                 state, userInput)
        else:
            return goToLevel(state, 'BLUE_CORRIDOR_8', userInput)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 27
0
def handleCellar(userInput, state):
    if userInput == 'GO WEST' or userInput == "GO NORTH" or userInput == "GO EAST" or userInput == "GO SOUTH":
        return handleInvalidDirection(state)
    elif userInput == 'TAKE STAIRS' or userInput == 'USE STAIRS':
        if "oilLamp" in state["inventory"]:
            return goToLevel(state, 'SHED', userInput) and handleNewShedDesc(state, userInput)
        else:
            return goToLevel(state, "SHED", userInput)
    elif userInput == "USE OIL LAMP" and "oilLamp" in state["inventory"]:
        return handleNewCellarDesc(state)
    elif userInput == "TAKE BRONZE KEY" or userInput == "TAKE KEY":
        return takeItem(state, 'bronzeKey')
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 28
0
def handleCribRoom(userInput, state):
    if userInput == 'GO NORTH':
        return goToLevel(state, 'TOY_CAR_ROOM', userInput)
    elif userInput == 'GO EAST':
        if 'nurseryRhyme' in state ['inventory']:
            return goToLevel(state, 'MESSY_ROOM', userInput) and messyRoomWithRhymePickedUp(state)
        else:
            return goToLevel(state, 'MESSY_ROOM', userInput)
        return handleInvalidDirection(state)
    elif userInput == "TAKE CRIB":
        return takeItem(state, 'crib')
    elif userInput == 'GO SOUTH' or userInput == 'GO WEST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 29
0
def handleToyCarRoom(userInput, state):
    if userInput == 'GO NORTH':
        if 'wornDoll' in state['inventory']:
            return goToLevel(state, 'BABY_ROOM', userInput) and babyRoomWithDollPickedUp(state)
        else:
            return goToLevel(state, 'BABY_ROOM', userInput)
    elif userInput == 'GO SOUTH':
        if 'crib' in state ['inventory']:
            return goToLevel(state, 'CRIB_ROOM', userInput) and cribRoomWithCribPickedUp(state)
        else:
            return goToLevel(state, 'CRIB_ROOM', userInput)
    elif userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)
Esempio n. 30
0
def handleGate(userInput, state):
    global gateCalled
    if userInput == "USE BRONZE KEY" or userInput == 'USE KEY' and "bronzeKey" in state["inventory"]:
        gateCalled = gateCalled + 1
        return goToLevel(state, 'LIGHTHOUSE_OUTSIDE', userInput)
    elif userInput == "GO NORTH":
        if "bronzeKey" in state["inventory"] and gateCalled >= 1:
            return goToLevel(state, "LIGHTHOUSE_OUTSIDE", userInput) and handleNewGateDesc(state)
        else:
            return handleDoorLock(state, "GATE", userInput)
    elif userInput == "GO SOUTH":
        return goToLevel(state, "BEACH", userInput) and handleNewBeachDesc(state, userInput)
    elif userInput == 'GO WEST' or userInput == 'GO EAST':
        return handleInvalidDirection(state)
    else:
        return handleInvalidInput(userInput, state)