Advertisement
Spocoman

02. MuOnline

Nov 3rd, 2023
883
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. health = 100
  2. bitcoins = 0
  3. rooms = input().split('|')
  4.  
  5. for i in range(len(rooms)):
  6.     tokens = rooms[i].split(' ')
  7.     command = tokens[0]
  8.     amount = int(tokens[1])
  9.     if command == "potion":
  10.         if health + amount > 100:
  11.             amount = 100 - health
  12.  
  13.         health += amount
  14.         print(f"You healed for {amount} hp.\nCurrent health: {health} hp.")
  15.     elif command == "chest":
  16.         bitcoins += amount
  17.         print(f"You found {amount} bitcoins.")
  18.     else:
  19.         health -= amount
  20.         if health <= 0:
  21.             print(f"You died! Killed by {command}.\nBest room: {i + 1}")
  22.             exit(0)
  23.         print(f"You slayed {command}.")
  24.  
  25. print(f"You've made it!\nBitcoins: {bitcoins}\nHealth: {health}")
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement