BdW44222

02.MU_Online

Jul 9th, 2021
821
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. max_health = 100
  2. initial_bitcoins = 0
  3. dungeon_rooms = [el for el in input().split("|")]
  4. best_room = 1
  5. win = True
  6. initial_health = max_health
  7.  
  8. for room in dungeon_rooms:
  9.     command = room.split()[0]
  10.     best_room += 1
  11.  
  12.     if command == "potion":
  13.         potion_amount = int(room.split()[1])
  14.         if initial_health + potion_amount > max_health:
  15.             potion_amount = max_health - initial_health
  16.             initial_health = max_health
  17.         else:
  18.             initial_health += potion_amount
  19.         print(f"You healed for {potion_amount} hp.")
  20.         print(f"Current health: {initial_health} hp.")
  21.  
  22.  
  23.     elif command == "chest":
  24.         bitcoin_amount = int(room.split()[1])
  25.         initial_bitcoins += bitcoin_amount
  26.         print(f"You found {bitcoin_amount} bitcoins.")
  27.  
  28.     else:
  29.         attack_of_monster = int(room.split()[1])
  30.         initial_health -= attack_of_monster
  31.  
  32.         if initial_health > 0:
  33.             print(f"You slayed {command}.")
  34.         else:
  35.             print(f"You died! Killed by {command}.")
  36.             print(f"Best room: {best_room - 1}")
  37.             win = False
  38.             break
  39.  
  40.  
  41. if best_room >= len(dungeon_rooms):
  42.     if win:
  43.         print(f"You've made it!\n"
  44.               f"Bitcoins: {initial_bitcoins}\n"
  45.               f"Health: {initial_health}")
RAW Paste Data