Advertisement
Guest User

[Python]Mu_online

a guest
Feb 29th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. dungeons_rooms = input().split('|')
  2.  
  3. INITIAL_HEALTH = 100
  4.  
  5. health = 100
  6. bitcoins = 0
  7. best_room = 0
  8. is_dead = False
  9.  
  10. for i in dungeons_rooms:
  11.     tokens = i.split(' ')
  12.     command = tokens[0]
  13.     args = int(tokens[1])
  14.     best_room += 1
  15.     if command == 'potion':
  16.         if health + args < INITIAL_HEALTH:
  17.             health += args
  18.             print(f'You healed for {args} hp.')
  19.         else:
  20.             diff = INITIAL_HEALTH - health
  21.             health = INITIAL_HEALTH
  22.             print(f'You healed for {diff} hp.')
  23.  
  24.         print(f'Current health: {health} hp.')
  25.  
  26.     elif command == 'chest':
  27.         bitcoins += args
  28.         print(f'You found {args} bitcoins.')
  29.     else:
  30.         health -= args
  31.         if health > 0:
  32.             print(f'You slayed {command}.')
  33.         elif health <= 0:
  34.             print(f'You died! Killed by {command}.')
  35.             is_dead = True
  36.             print(f'Best room: {best_room}')
  37.             break
  38.  
  39. if not is_dead:
  40.     print(f'You\'ve made it!\nBitcoins: {bitcoins}\nHealth: {health}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement