Created
September 27, 2018 18:05
-
-
Save XChrisUnknownX/dcb6fff7f3858d65e9b5b569f1f87935 to your computer and use it in GitHub Desktop.
GuessThePassword.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"] | |
numbers = ["0","1","2","3","4","5","6","7","8","9"] | |
def createthepassword(): | |
letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"] | |
numbers = ["0","1","2","3","4","5","6","7","8","9"] | |
letter = "letters" | |
number = "numbers" | |
password = [0,1,2,3,4,5,6] | |
#letterone | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[0] = random.choice(letters) | |
else: | |
password[0] = random.choice(numbers) | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[1] = random.choice(letters) | |
else: | |
password[1] = random.choice(numbers) | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[2] = random.choice(letters) | |
else: | |
password[2] = random.choice(numbers) | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[3] = random.choice(letters) | |
else: | |
password[3] = random.choice(numbers) | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[4] = random.choice(letters) | |
else: | |
password[4] = random.choice(numbers) | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[5] = random.choice(letters) | |
else: | |
password[5] = random.choice(numbers) | |
letterornumber = random.choice([letter,number]) | |
if letterornumber == letter: | |
password[6] = random.choice(letters) | |
else: | |
password[6] = random.choice(numbers) | |
return password | |
def startgame(): | |
thepass = createthepassword() | |
print("W",end="") | |
time.sleep(.047) | |
print("e",end="") | |
time.sleep(.047) | |
print("l",end="") | |
time.sleep(.047) | |
print("c",end="") | |
time.sleep(.047) | |
print("o",end="") | |
time.sleep(.047) | |
print("m",end="") | |
time.sleep(.047) | |
print("e",end=" ") | |
time.sleep(.047) | |
print("t",end="") | |
time.sleep(.165) | |
print("o",end=" ") | |
time.sleep(.165) | |
print("t",end="") | |
time.sleep(.11) | |
print("h",end="") | |
time.sleep(.11) | |
print("e",end=" ") | |
time.sleep(.11) | |
print("g",end="") | |
time.sleep(.0825) | |
print("a",end="") | |
time.sleep(.0825) | |
print("m",end="") | |
time.sleep(.0825) | |
print("e",end=", ") | |
time.sleep(.0825) | |
print("D",end="") | |
time.sleep(.165) | |
print("r",end=". ") | |
time.sleep(.165) | |
# masters | |
print("M",end="") | |
time.sleep(.047) | |
print("a",end="") | |
time.sleep(.047) | |
print("s",end="") | |
time.sleep(.047) | |
print("t",end="") | |
time.sleep(.047) | |
print("e",end="") | |
time.sleep(.047) | |
print("r",end="") | |
time.sleep(.047) | |
print("s",end=". ") | |
time.sleep(.047) | |
print() | |
print() | |
print("M",end="") | |
time.sleep(.165) | |
print("y",end=" ") | |
time.sleep(.165) | |
print("n",end="") | |
time.sleep(.0825) | |
print("a",end="") | |
time.sleep(.0825) | |
print("m",end="") | |
time.sleep(.0825) | |
print("e",end=" ") | |
time.sleep(.0825) | |
print("i",end="") | |
time.sleep(.165) | |
print("s",end=" ") | |
time.sleep(.165) | |
print("B",end="") | |
time.sleep(.0825) | |
print("L",end="") | |
time.sleep(.0825) | |
print("A",end="") | |
time.sleep(.0825) | |
print("D",end="") | |
time.sleep(.0825) | |
print("E",end=". ") | |
time.sleep(.0825) | |
print() | |
print() | |
print("I",end=" ") | |
time.sleep(.33) | |
print("a",end="") | |
time.sleep(.165) | |
print("m",end=" ") | |
time.sleep(.165) | |
print("a",end="") | |
time.sleep(.165) | |
print("n",end=" ") | |
time.sleep(.165) | |
print("a",end="") | |
time.sleep(.033) | |
print("r",end="") | |
time.sleep(.033) | |
print("t",end="") | |
time.sleep(.033) | |
print("i",end="") | |
time.sleep(.033) | |
print("f",end="") | |
time.sleep(.033) | |
print("i",end="") | |
time.sleep(.033) | |
print("c",end="") | |
time.sleep(.033) | |
print("i",end="") | |
time.sleep(.033) | |
print("a",end="") | |
time.sleep(.033) | |
print("l",end=" ") | |
time.sleep(.033) | |
print("i",end="") | |
time.sleep(.0275) | |
print("n",end="") | |
time.sleep(.0275) | |
print("t",end="") | |
time.sleep(.0275) | |
print("e",end="") | |
time.sleep(.0275) | |
print("l",end="") | |
time.sleep(.0275) | |
print("l",end="") | |
time.sleep(.0275) | |
print("i",end="") | |
time.sleep(.0275) | |
print("g",end="") | |
time.sleep(.0275) | |
print("e",end="") | |
time.sleep(.0275) | |
print("n",end="") | |
time.sleep(.0275) | |
print("c",end="") | |
time.sleep(.0275) | |
print("e",end=" ") | |
time.sleep(.0275) | |
print("d",end="") | |
time.sleep(.04125) | |
print("e",end="") | |
time.sleep(.04125) | |
print("s",end="") | |
time.sleep(.04125) | |
print("i",end="") | |
time.sleep(.04125) | |
print("g",end="") | |
time.sleep(.04125) | |
print("n",end="") | |
time.sleep(.04125) | |
print("e",end="") | |
time.sleep(.04125) | |
print("d",end=" ") | |
time.sleep(.04125) | |
print("b",end="") | |
time.sleep(.165) | |
print("y",end=" ") | |
time.sleep(.165) | |
company = random.choice(["Plato, Inc.","Manatee Miracles","Smoke and Fire United"]) | |
time.sleep(.33) | |
print(company,end=" ") | |
print("t",end="") | |
time.sleep(.165) | |
print("o",end=" ") | |
time.sleep(.166) | |
print("p",end="") | |
time.sleep(.047) | |
print("r",end="") | |
time.sleep(.047) | |
print("o",end="") | |
time.sleep(.047) | |
print("t",end="") | |
time.sleep(.047) | |
print("e",end="") | |
time.sleep(.047) | |
print("c",end="") | |
time.sleep(.047) | |
print("t",end=" ") | |
time.sleep(.047) | |
print("s",end="") | |
time.sleep(.037) | |
print("e",end="") | |
time.sleep(.037) | |
print("n",end="") | |
time.sleep(.037) | |
print("s",end="") | |
time.sleep(.037) | |
print("i",end="") | |
time.sleep(.037) | |
print("t",end="") | |
time.sleep(.037) | |
print("i",end="") | |
time.sleep(.037) | |
print("v",end="") | |
time.sleep(.037) | |
print("e",end=" ") | |
time.sleep(.037) | |
print("i",end="") | |
time.sleep(.03) | |
print("n",end="") | |
time.sleep(.03) | |
print("f",end="") | |
time.sleep(.03) | |
print("o",end="") | |
time.sleep(.03) | |
print("r",end="") | |
time.sleep(.03) | |
print("m",end="") | |
time.sleep(.03) | |
print("a",end="") | |
time.sleep(.03) | |
print("t",end="") | |
time.sleep(.03) | |
print("i",end="") | |
time.sleep(.03) | |
print("o",end="") | |
time.sleep(.03) | |
print("n",end=". ") | |
print() | |
print() | |
print("I",end=" ") | |
time.sleep(.33) | |
print("h",end="") | |
time.sleep(.0825) | |
print("a",end="") | |
time.sleep(.0825) | |
print("v",end="") | |
time.sleep(.0825) | |
print("e",end=" ") | |
time.sleep(.0825) | |
print("c",end="") | |
time.sleep(.047) | |
print("r",end="") | |
time.sleep(.047) | |
print("e",end="") | |
time.sleep(.047) | |
print("a",end="") | |
time.sleep(.047) | |
print("ted",end=" ") | |
time.sleep(.141) | |
print("a",end=" ") | |
time.sleep(.33) | |
print("sev",end="") | |
time.sleep(.198) | |
print("en",end=" ") | |
time.sleep(.132) | |
print("let",end="") | |
time.sleep(.165) | |
print("ter",end=" ") | |
time.sleep(.165) | |
print("pa",end="") | |
time.sleep(.0825) | |
print("ss",end="") | |
time.sleep(.0825) | |
print("wo",end="") | |
time.sleep(.0825) | |
print("rd",end=". ") | |
time.sleep(.0825) | |
print() | |
print() | |
print("The",end=" ") | |
time.sleep(.33) | |
print("pass",end="") | |
time.sleep(.165) | |
print("word",end=" ") | |
time.sleep(.165) | |
print("consist",end="") | |
time.sleep(.3) | |
print("s",end=" ") | |
time.sleep(.03) | |
print("o",end="") | |
time.sleep(.165) | |
print("f",end=" ") | |
time.sleep(.165) | |
print("let",end="") | |
time.sleep(.16) | |
print("ter",end="") | |
time.sleep(.16) | |
print("s",end=" ") | |
time.sleep(.01) | |
print("and",end=" ") | |
time.sleep(.33) | |
print("num",end="") | |
time.sleep(.16) | |
print("ber",end="") | |
time.sleep(.16) | |
print("s",end=". ") | |
time.sleep(.01) | |
print() | |
print() | |
print("T",end="") | |
time.sleep(.066) | |
print("h",end="") | |
time.sleep(.066) | |
print("o",end="") | |
time.sleep(.066) | |
print("s",end="") | |
time.sleep(.066) | |
print("e",end=" ") | |
time.sleep(.066) | |
print("letter",end="") | |
time.sleep(.3) | |
print("s",end=" ") | |
time.sleep(.03) | |
print("are",end=", ") | |
time.sleep(.33) | |
print("o",end="") | |
time.sleep(.165) | |
print("r",end=" ") | |
time.sleep(.165) | |
print("c",end="") | |
time.sleep(.11) | |
print("a",end="") | |
time.sleep(.11) | |
print("n",end=" ") | |
time.sleep(.11) | |
print("b",end="") | |
time.sleep(.165) | |
print("e",end=", ") | |
time.sleep(.165) | |
print("bo",end="") | |
time.sleep(.165) | |
print("th",end=" ") | |
time.sleep(.165) | |
print("u",end="") | |
time.sleep(.073) | |
print("p",end="") | |
time.sleep(.073) | |
print("p",end="") | |
time.sleep(.073) | |
print("e",end="") | |
time.sleep(.073) | |
print("r",end="") | |
time.sleep(.073) | |
print("c",end="") | |
time.sleep(.073) | |
print("a",end="") | |
time.sleep(.073) | |
print("s",end="") | |
time.sleep(.073) | |
print("e",end=" ") | |
time.sleep(.073) | |
print("and",end=" ") | |
time.sleep(.073) | |
print("l",end="") | |
time.sleep(.073) | |
print("o",end="") | |
time.sleep(.073) | |
print("w",end="") | |
time.sleep(.073) | |
print("e",end="") | |
time.sleep(.073) | |
print("r",end="") | |
time.sleep(.073) | |
print("c",end="") | |
time.sleep(.073) | |
print("a",end="") | |
time.sleep(.073) | |
print("s",end="") | |
time.sleep(.073) | |
print("e",end=". ") | |
time.sleep(.073) | |
print() | |
print() | |
print("Can",end=" ") | |
time.sleep(.33) | |
print("you",end=" ") | |
time.sleep(.33) | |
print("guess",end=" ") | |
time.sleep(.33) | |
print("the",end=" ") | |
time.sleep(.33) | |
print("pass",end="") | |
time.sleep(.165) | |
print("word",end=" ") | |
time.sleep(.165) | |
print("in",end=" ") | |
time.sleep(.33) | |
print("less than",end=" ") | |
time.sleep(.33) | |
print("100",end=" ") | |
time.sleep(.165) | |
print("attempt",end="") | |
time.sleep(.3) | |
print("s",end="? ") | |
time.sleep(.03) | |
print() | |
print() | |
print("I",end=" ") | |
time.sleep(.33) | |
print("think",end=" ") | |
time.sleep(.33) | |
print("not",end=". ") | |
time.sleep(.33) | |
print("Good",end=" ") | |
time.sleep(.33) | |
print("luck",end="! ") | |
time.sleep(.33) | |
print() | |
print() | |
attempt = 0 | |
attempts = str(attempt) | |
while True: | |
print("Input",end=" ") | |
time.sleep(.33) | |
print("password",end=". ") | |
time.sleep(.33) | |
attempts = str(attempt) | |
print("Attempts",end=": ") | |
print(attempts,end=". ") | |
print() | |
print() | |
if attempt >= 100: | |
print("All the doors and vents around you shut themselves and lock, and the monitor powers off. There is no escape, and no one can hear your pleas for help over the next four days...") | |
time.sleep(2) | |
print("Game over. Tap a key to try again.") | |
input() | |
startgame() | |
else: | |
pass | |
try: | |
bogey = [0,1,2,3,4,5,6] | |
bogey[0] = str(thepass[0]) | |
bogey[1] = str(thepass[1]) | |
bogey[2] = str(thepass[2]) | |
bogey[3] = str(thepass[3]) | |
bogey[4] = str(thepass[4]) | |
bogey[5] = str(thepass[5]) | |
bogey[6] = str(thepass[6]) | |
thebogey = (bogey[0]+bogey[1]+bogey[2]+bogey[3]+bogey[4]+bogey[5]+bogey[6]) | |
except: | |
pass | |
hint1randomnumber = random.randint(0,6) | |
hint1 = ("Pretty sure there is a " + bogey[hint1randomnumber] + " in there.") | |
if hint1randomnumber < 2: | |
hint2 = ("I think " + bogey[hint1randomnumber] + " is not character four, five, six, or seven.") | |
elif hint1randomnumber == 3: | |
hint2 = (bogey[hint1randomnumber]+" is the fourth character.") | |
elif hint1randomnumber > 3: | |
hint2 = (bogey[hint1randomnumber]+" is character five, six, or seven.") | |
else: | |
hint2 = ("No hint for you.") | |
hint3 = "No hint for you." | |
hint4 = "The password is case sensitive." | |
if hint1randomnumber == 0: | |
hint5position = "first" | |
elif hint1randomnumber == 1: | |
hint5position = "second" | |
elif hint1randomnumber == 2: | |
hint5position = "third" | |
elif hint1randomnumber == 3: | |
hint5position = "fourth" | |
elif hint1randomnumber == 4: | |
hint5position = "fifth" | |
elif hint1randomnumber == 5: | |
hint5position = "sixth" | |
elif hint1randomnumber == 6: | |
hint5position = "seventh" | |
else: | |
pass | |
hint5 = (bogey[hint1randomnumber]+" must be the " + hint5position + " character.") | |
#hint 6 is a testing cheat | |
hint6 = thebogey | |
hints = [hint1,hint2,hint3,hint4,hint5,hint1,hint2,hint5,hint1,hint2,hint5,hint1,hint2,hint5,hint5,hint1,hint1,hint1,hint1] | |
hintdisplay = random.choice(hints) | |
print(hintdisplay) | |
print() | |
print("INPUT PASSWORD",end=": ") | |
guess = input() | |
if guess == thebogey: | |
print("Correct",end=" ") | |
time.sleep(.33) | |
print("password",end=" ") | |
time.sleep(.33) | |
print("entered",end=". ") | |
time.sleep(.33) | |
print("Congratulations",end=", ") | |
time.sleep(.33) | |
print("doctor!") | |
time.sleep(.33) | |
print("The entire facility's security system deactivates. You're in.") | |
input("Current end of game.") | |
else: | |
print("Password entered does not match. Try again.") | |
print() | |
attempt += 1 | |
startgame() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment