Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- initial_health = 100
- initial_bitcoins = 0
- counter = 0
- dungeon_rooms = input().split('|')
- you_didnt_make_it = False
- for each_room in dungeon_rooms:
- command = each_room.split()
- item_monster = command[0]
- value = int(command[1])
- counter += 1
- if item_monster == 'potion':
- if initial_health + value <= 100: # 90 + 30 = 120
- initial_health += value
- else:
- value = 100 - initial_health
- initial_health = 100
- print(f'You healed for {value} hp.')
- print(f'Current health: {initial_health} hp.')
- elif item_monster == 'chest':
- initial_bitcoins += value
- print(f'You found {value} bitcoins.')
- else:
- if initial_health - value > 0:
- initial_health -= value
- print(f'You slayed {item_monster}.')
- else:
- print(f'You died! Killed by {item_monster}.')
- print(f'Best room: {counter}')
- you_didnt_make_it = True
- break
- if not you_didnt_make_it:
- print(f'You\'ve made it!\nBitcoins: {initial_bitcoins}\nHealth: {initial_health}')
Advertisement
Add Comment
Please, Sign In to add comment