Sichanov

muonline

Oct 23rd, 2021
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. initial_health = 100
  2. initial_bitcoins = 0
  3. counter = 0
  4. dungeon_rooms = input().split('|')
  5. you_didnt_make_it = False
  6. for each_room in dungeon_rooms:
  7. command = each_room.split()
  8. item_monster = command[0]
  9. value = int(command[1])
  10. counter += 1
  11. if item_monster == 'potion':
  12. if initial_health + value <= 100: # 90 + 30 = 120
  13. initial_health += value
  14. else:
  15. value = 100 - initial_health
  16. initial_health = 100
  17. print(f'You healed for {value} hp.')
  18. print(f'Current health: {initial_health} hp.')
  19. elif item_monster == 'chest':
  20. initial_bitcoins += value
  21. print(f'You found {value} bitcoins.')
  22. else:
  23. if initial_health - value > 0:
  24. initial_health -= value
  25. print(f'You slayed {item_monster}.')
  26. else:
  27. print(f'You died! Killed by {item_monster}.')
  28. print(f'Best room: {counter}')
  29. you_didnt_make_it = True
  30. break
  31. if not you_didnt_make_it:
  32. print(f'You\'ve made it!\nBitcoins: {initial_bitcoins}\nHealth: {initial_health}')
Advertisement
Add Comment
Please, Sign In to add comment