Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Dictionary of names and passwords, expanding on demand.
- charsAvailable = {'vyasa':'mypassword',
- 'dhez':'mypassword',
- 'destre':'mypassword'}
- # -----------------------> Functions <-----------------------
- # Login with a char passed to this
- def charLogin(name):
- if name in charsAvailable.keys():
- passw = input('Welcome ' + name.title() + '. Please enter your password: ')
- if passw == charsAvailable[name]:
- print('Welcome back ' + name.title() + '.')
- else:
- for i in range(1,4):
- passtry = input('Chance ' + str(i) + ' out of 3. Please enter your password again: ')
- if passtry == charsAvailable[name]:
- print('Welcome back ' + name.title() + '.')
- break
- else:
- print('Wrong password.')
- else:
- print('There is no character by that name.')
- welcomeScreen()
- # Creates a new char and adds it to the dictionary
- def charCreate():
- chosenName = input('Please select a name for your character: ')
- chosenPassW = input('Your name will be ' + chosenName + '. Please choose a password: ')
- charsAvailable[chosenName] = chosenPassW
- print('Account created. You may now login with your new character.\n')
- welcomeScreen()
- # The welcome screen from which we go
- def welcomeScreen():
- print('Welcome to Genesis.')
- choice = input('Please enter your name or type \'new\' to create a new character: ')
- if choice.isalpha() == False:
- print('Names may only contain letters')
- welcomeScreen()
- elif choice == 'new':
- charCreate()
- else:
- charLogin(choice)
- welcomeScreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement