viligen

mooving_target

Oct 16th, 2021
935
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. targets = list(map(int, input().split()))
  2.  
  3. while True:
  4.     command = input().split()
  5.     if command[0] == "End":
  6.         break
  7.     action = command[0]
  8.     index = int(command[1])
  9.     value2 = int(command[2])
  10.  
  11.     if "Shoot" in command and 0 <= index < len(targets):
  12.         if targets[index] - value2 <= 0:
  13.             targets.pop(index)
  14.         else:
  15.             targets[index] -= value2
  16.     if "Add" in command and 0 <= index < len(targets):
  17.         targets.insert(index, value2)
  18.     elif "Add" in command:
  19.         print("Invalid placement!")
  20.     if "Strike" in command and 0 <= (index - value2) < len(targets) and 0 <= (index + value2) < len(targets):
  21.         for i in range((index + value2), (index - value2) - 1, -1):
  22.             targets.pop(i)
  23.     elif "Strike" in command:
  24.         print("Strike missed!")
  25.  
  26. print('|'.join([str(n) for n in targets]))
  27.  
RAW Paste Data