Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- targets = list(map(int, input().split(' ')))
- while True:
- command = input()
- if command == 'End':
- break
- command = command.split()
- type_of_command = command[0]
- index = int(command[1])
- if type_of_command == 'Shoot':
- power = int(command[2])
- if 0 <= index < len(targets):
- targets[index] -= power
- if targets[index] <= 0:
- targets.pop(index)
- elif type_of_command == 'Add':
- value = int(command[2])
- if 0 <= index < len(targets):
- targets[index] += value
- else:
- print('Invalid placement!')
- elif type_of_command == 'Strike':
- radius = int(command[2])
- if 0 <= index < len(targets):
- if index - radius >= 0 and \
- index + radius < len(targets):
- for i in range(index + radius, index - radius -1, -1):
- targets.pop(i)
- else:
- print("Strike missed!")
- print(('|').join(str(s) for s in targets))
Advertisement
Add Comment
Please, Sign In to add comment