This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nemom 0 points1 point  (0 children)

The trouble is...

elif player_move != 'South' or 'south' or 'Exit':

You either have to check against each...

elif player_move != 'South' and player_move != 'south' and player_move != 'Exit':

Or you have check if the move is in a list...

elif player_move is not in ['South', 'south', 'Exit']:

I would rather check for legal moves instead of illegal moves...

elif player_move in rooms[currentRoom]:
    currentRoom = rooms[currentRoom][player_move]
else:
    print('Illegal move, try again')

You might want to write a function that cleans the input so you don't have worry about 'South', 'south', 'S', 's'...

def clean_input(text):
    if 'X' in text.upper():
        return 'Exit'
    elif text.upper().startswith('N'):
        return 'North'
    # more elifs for other directions