andonyan

MU Online

Feb 29th, 2020
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. initial_health = 100
  2. initial_bitcoins = 0
  3. dungeon_rooms = input().split('|')
  4.  
  5. for i in range(len(dungeon_rooms)):
  6.     tokens = dungeon_rooms[i].split()
  7.     command = tokens[0]
  8.     value = int(tokens[1])
  9.     if command == 'potion':
  10.         if value + initial_health <= 100:
  11.             initial_health += value
  12.             print(f'You healed for {value} hp.')
  13.             print(f'Current health: {initial_health} hp.')
  14.         else:
  15.             print(f'You healed for {100 - initial_health} hp.')
  16.             initial_health = 100
  17.             print(f'Current health: {initial_health} hp.')
  18.     elif command == 'chest':
  19.         initial_bitcoins += value
  20.         print(f'You found {value} bitcoins.')
  21.     else:
  22.         initial_health -= value
  23.         if initial_health > 0:
  24.             print(f'You slayed {command}.')
  25.         else:
  26.             print(f'You died! Killed by {command}.')
  27.             print(f'Best room: {i + 1}')
  28.             break
  29. else:
  30.     print(f'You\'ve made it!')
  31.     print(f'Bitcoins: {initial_bitcoins}')
  32.     print(f'Health: {initial_health}')
Advertisement
Add Comment
Please, Sign In to add comment