Advertisement
SharpEdged

Escape The Building

May 27th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.15 KB | None | 0 0
  1. import random
  2. import time
  3.  
  4. running = True
  5.  
  6.  
  7. print("\n" * 100)
  8. Diff = 10
  9. Skip = input("Skip intro? (Yes/No)")
  10. Slow = input("Cinematic mode? (Yes/No)")
  11.  
  12. if Skip not in ["yes", "Yes", "YES", "y", "Y"]:
  13.     print("Welcome to\n--Escape The Building--\n\nYou robbed the building on 20th floor (for easy), and You have to get to the ground floor.\nThere is guard on the ground floor stopping you from escaping the building.\nThere are also investigators, which are investigating rooms from 1st floor, and then 2nd floor (they can skip rooms on harder modes)...\nThere is inspector following your steps, and he is behind you 2 steps, which means if You go to\nfloor 4 from floor 1 and then to floor 8 he will get to floor 1 because 2 actions before you were there,\nand also he will notice if someone is currently in previous room, so you cant sneek behind him.\nLast problem are dogs, and they jump on higer or lower floors. How much depends on difficulty.\nYou can use elevator and go on whatever floor you want, but if someone is in it then you can only go\n1 floor up or down.\n\nGood luck and escape the building! (1 minute)\n")
  14.     Done = input("Press enter to continue...")
  15.  
  16. while running:
  17.     while Diff not in ["1", "2", "3"]:
  18.         Diff = input(
  19.             '\nEasy - 20 floors, 1 dog, dog tires in 5 actions,\ndog and investigators have speed of 1, guard needs 10 actions to move,\nelevator is 20% used\n\nMedium - 15 floors, 2 dogs, dogs tire in 15 actions,\ndogs and investigators have speed of 2, guard needs 10 actions to move,\nelevator is 33.33% used\n\nHard - 10 floors, 3 dogs, dogs tire in 20 actions,\ndogs and investigators have speed of 3, guard needs 20 actions to move,\nelevator is 50% used\n\nDifficulty? Type "1" for easy, "2" for medium, "3" for hard')
  20.  
  21.     Diff = int(Diff)
  22.     You = 0
  23.     You_Copy1 = 0
  24.     Guard = 0
  25.     Guard_Count = 0
  26.     Investigators = 0
  27.     Inspector = 0
  28.     Inspector_Copy1 = 0
  29.     Dogs = 0
  30.     Dogs2 = 0
  31.     Dogs3 = 0
  32.     Dog_Count = 0
  33.     Action_Count = 0
  34.     Space = "-" * 30
  35.     Walk = "mid"
  36.     Elevator = True
  37.     Player_not_in_range = True
  38.     Dog_Sleep = False
  39.     Guard_Alert = False
  40.     GameRunning = True
  41.     Dog_Diff = Dog_Diff2 = Dog_Diff3 = 0
  42.  
  43.     if Diff == 1:
  44.         ElevatorDiff = 5
  45.         Dog_Diff = 1
  46.         Floors = 20
  47.     elif Diff == 2:
  48.         ElevatorDiff = 3
  49.         Dog_Diff = Dog_Diff2 = 1
  50.         Floors = 15
  51.     elif Diff == 3:
  52.         ElevatorDiff = 1
  53.         Dog_Diff = Dog_Diff2 = Dog_Diff3 = 1
  54.         Floors = 10
  55.  
  56.     ADog_Diff = 1
  57.     ADog_Diff2 = 1
  58.     ADog_Diff3 = 1
  59.  
  60.     if Dog_Diff == 1:
  61.         ADog_Diff = 0
  62.     if Dog_Diff2 == 1:
  63.         ADog_Diff2 = 0
  64.     if Dog_Diff3 == 1:
  65.         ADog_Diff3 = 0
  66.  
  67.     if Slow in ["Yes", "yes"]:
  68.         SlowTime = 1
  69.     else:
  70.         SlowTime = 0
  71.  
  72.     while GameRunning:
  73.         Inspector_Copy1 = Inspector
  74.         Inspector = You_Copy1
  75.         You_Copy1 = You
  76.  
  77.         Elevator_Number = random.randint(0, ElevatorDiff)
  78.         if Elevator_Number == 1:
  79.             Elevator = False
  80.         else:
  81.             Elevator = True
  82.  
  83.         Guard_Count += 1
  84.         if Guard_Count >= (30 - Floors):
  85.             Elevator = False
  86.  
  87.         Action_Count += 1
  88.         print("\n--- Action", Action_Count, "---")
  89.         while Player_not_in_range:
  90.             if Elevator == True:
  91.                 You = input("\nGo To which floor?")
  92.                 You = int(You)
  93.                 if 0 <= You <= Floors:
  94.                     Player_not_in_range = False
  95.             else:
  96.                 while Walk not in ["up", "down"]:
  97.                     Walk = input("Someone is in the elevator\nWalk 'up' or 'down'?")
  98.                     if Action_Count == 1:
  99.                         You = Floors
  100.                     if Walk == "up":
  101.                         You += 1
  102.                         if You > Floors:
  103.                             You = Floors
  104.                     elif Walk == "down":
  105.                         You -= 1
  106.                     Player_not_in_range = False
  107.  
  108.         Investigators += random.randint(1, Diff)
  109.         if Investigators > Floors:
  110.             Investigators = 0
  111.  
  112.         ADogs = random.randint(-Diff, Diff)
  113.         ADogs2 = random.randint(-Diff, Diff)
  114.         ADogs3 = random.randint(-Diff, Diff)
  115.         Dogs = (Dogs + ADogs) * Dog_Diff - ADog_Diff
  116.         Dogs2 = (Dogs2 + ADogs2) * Dog_Diff2 - ADog_Diff2
  117.         Dogs3 = (Dogs3 + ADogs3) * Dog_Diff3 - ADog_Diff3
  118.         if Dogs > Floors:
  119.             Dogs = Floors
  120.         elif (Dogs < 0) & (Dog_Diff != 0):
  121.             Dogs = -Dogs
  122.         if Dogs2 > Floors:
  123.             Dogs2 = Floors
  124.         elif (Dogs2 < 0) & (Dog_Diff2 != 0):
  125.             Dogs2 = -Dogs2
  126.         if Dogs3 > Floors:
  127.             Dogs3 = Floors
  128.         elif (Dogs3 < 0) & (Dog_Diff3 != 0):
  129.             Dogs3 = -Dogs3
  130.         Dog_Count += 1
  131.         if Dog_Count >= (29 - Floors):
  132.             Dog_Count = -2
  133.         if Dog_Count < 0:
  134.             Dog_Sleep = True
  135.             Dogs = -1
  136.             Dogs2 = -1
  137.             Dogs3 = -1
  138.         else:
  139.             Dog_Sleep = False
  140.  
  141.         if Guard_Count == 0:
  142.             Guard = 0
  143.         elif Guard_Count >= (30 - Floors):
  144.             Guard = 1
  145.             Guard_Count = -1
  146.         if Guard_Count < 0:
  147.             Guard_Alert = True
  148.         else:
  149.             Guard_Alert = False
  150.  
  151.         Player_not_in_range = True
  152.         Walk = "mid"
  153.  
  154.         if You in [Guard, Inspector, Inspector_Copy1, Investigators, Dogs, Dogs2, Dogs3]:
  155.             GameRunning = False
  156.             GG = False
  157.         elif You == 0:
  158.             GameRunning = False
  159.             GG = True
  160.         time.sleep(0.1)
  161.  
  162.         print("\nYou are on floor", You)
  163.         SlowMo = 1 * SlowTime
  164.         time.sleep(SlowMo)
  165.  
  166.         if Guard_Alert:
  167.             print("Guard has checked floor 1 and will move back next move")
  168.         else:
  169.             print("Guard is on floor", Guard, "\n", Space, "and he will move in", 30 - Floors - Guard_Count, "actions")
  170.         SlowMo = 3 * SlowTime
  171.         time.sleep(SlowMo)
  172.  
  173.         print("Investigators are on floor", Investigators)
  174.         SlowMo = 2 * SlowTime
  175.         time.sleep(SlowMo)
  176.  
  177.         print("Inspector is on floor", Inspector, "\n", Space, "he can see floor", Inspector_Copy1, ", and he will go to floor", You_Copy1)
  178.         SlowMo = 5 * SlowTime
  179.         time.sleep(SlowMo)
  180.  
  181.         if Dog_Sleep:
  182.             print("Dogs are sleeping and will wake in", -Dog_Count, "actions\n\n")
  183.             SlowMo = 1 * SlowTime
  184.             time.sleep(SlowMo)
  185.         else:
  186.             if Diff > 0:
  187.                 print("1st dog is on floor", Dogs)
  188.             if Diff > 1:
  189.                 print("2nd dog is on floor", Dogs2)
  190.             if Diff > 2:
  191.                 print("3nd dog is on floor", Dogs3)
  192.             print("\n", Space, "and they will be tired in", 28 - Floors - Dog_Count, "actions\n\n")
  193.             SlowMo = 3 * SlowTime
  194.             time.sleep(SlowMo)
  195.  
  196.     if GG == True:
  197.         print("Congrats, you escaped the building on difficulty", Diff, "!")
  198.     else:
  199.         print("You Got caught :(")
  200.  
  201.     running = input("Play again?(Yes/No)")
  202.     if running not in ["yes", "Yes", "y", "Y"]:
  203.         running = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement