I'm currently working on this text based game for a python introduction class. I can't figure out why some parts of the code takes me to another part that I didn't assign. Like I would go east then north, which should take me to 'Hidden Mud Warehouse', but it would take me to the beginning room instead. I know there's a lot of mistakes of inefficient way of coding there, but please just comment on how to fix the main problem for now. Thanks
def show_ins():
print("NEUTRALIZE THE ATAKSUKI!")
print("Team up with 6 teammates to stop the Ataksuki, or they will kill your dear friend")
print("Move commands: go South, go North, go East, go West, Exit")
print("Add teammate: get 'teammate name'")
def main():
rooms = {
'Hidden Mud Village Hall': {'South': 'The Clinic', 'West': 'The Flower Shop', 'North': 'The Bookstore',
'East': 'Yoga House'},
'The Clinic': {'North': 'Hidden Mud Village Hall', 'East': 'Weapons Depot', 'teammate': 'Lady Choyi'},
'Weapons Depot': {'West': 'The Clinic', 'teammate': 'Ten'},
'The Flower Shop': {'East': 'Hidden Mud Village Hall', 'teammate': 'Askura'},
'The Bookstore': {'South': 'Hidden Mud Village Hall', 'East': 'The Gym', 'teammate': 'Akashi'},
'The Gym': {'West': 'The Bookstore', 'teammate': 'Mighty Dude'},
'Yoga House': {'West': 'Hidden Mud Village Hall', 'North': 'Hidden Mud Warehouse', 'teammate': 'Neju'},
'Hidden Mud Warehouse': {'South': 'Yoga House', 'character': 'The Ataksuki'}
}
teammates = []
while True:
show_ins()
currentroom = 'Hidden Mud Village Hall'
command = ''
while currentroom == 'Hidden Mud Warehouse':
if teammates != ['Lady Choyi', 'Ten', 'Askura', 'Neju', 'Mighty Dude', 'Akashi']:
print('You failed. Try again.')
elif teammates == ['Lady Choyi', 'Ten', 'Askura', 'Neju', 'Mighty Dude', 'Akashi']:
print('Good job! You saved Garaa!')
while currentroom == 'Hidden Mud Village Hall':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go south', 'go South', 'go west', 'go West', 'go north', 'go North', 'go east', 'go East', 'exit','Exit']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['go south', 'go South']:
currentroom = 'The Clinic'
elif command in ['go west', 'go West']:
currentroom = 'The Flower Shop'
elif command in ['go north', 'go North']:
currentroom = 'The Bookstore'
elif command in ['go east', 'go East']:
currentroom = 'Yoga House'
while currentroom == 'The Clinic':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('You see Lady Choyi')
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go north', 'go North', 'go east', 'go East', 'exit', 'Exit', 'get lady choyi', 'get Lady Choyi']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['get lady choyi', 'get Lady Choyi']:
print('Lady Choyi has joined you')
teammates.append ('Lady Choyi')
elif command in ['go north', 'go North']:
currentroom = 'Hidden Mud Village Hall'
elif command in ['go east', 'go East']:
currentroom = 'Weapons Depot'
while currentroom == 'The Flower Shop':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('You see Askura')
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go east', 'go East', 'exit', 'Exit', 'get askura', 'get Askura']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['get askura', 'get Askura']:
print('Askura has joined you')
teammates.append ('Askura')
elif command in ['go east', 'go East']:
currentroom = 'Hidden Mud Village Hall'
while currentroom == 'The Bookstore':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('You see Akashi')
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go south', 'go South', 'go east', 'go East', 'get akashi', 'get Akashi']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['get akashi', 'get Akashi']:
print('Akashi has joined you')
teammates.append ('Akashi')
elif command in ['go south', 'go South']:
currentroom = 'Hidden Mud Village Hall'
elif command in ['go east', 'go East']:
currentroom = 'The Gym'
while currentroom == 'Yoga House':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('You see Neju')
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go west', 'go West', 'go north', 'go North', 'get Neju', 'get neju']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['get Neju', 'get neju']:
print('Neju has joined you')
teammates.append ('Neju')
elif command in ['go west', 'go West']:
currentroom = 'Hidden Mud Village Hall'
elif command in ['go north', 'go North']:
currentroom = 'Hidden Mud Warehouse'
while currentroom == 'Weapons Depot':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('You see Ten')
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go west', 'go West', 'exit', 'Exit', 'get ten', 'get Ten']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['get ten', 'get Ten']:
print('Ten has joined you')
teammates.append ('Ten')
elif command in ['go west', 'go West']:
currentroom = 'The Clinic'
while currentroom == 'The Gym':
print('------------------------------------------------------------------------------------')
print('You are currently in', currentroom)
print('You see Mighty Dude')
print('Teammates: {}'.format(teammates))
command = input('Command:\n')
if command not in ['go west', 'go West', 'exit', 'Exit', 'get mighty dude', 'get Mighty Dude']:
print('------------------------------------------------------------------------------------')
print('Invalid command!')
elif command in ['exit', 'Exit']:
currentroom = 'Exit'
print('Coward! Come back here!')
quit()
elif command in ['get mighty dude', 'get Mighty Dude']:
print('Mighty Dude has joined you')
teammates.append ('Mighty Dude')
elif command in ['go west', 'go West']:
currentroom = 'The Bookstore'
main()