Mel_Sea

Archery Tournament

Mar 17th, 2020
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. targets = list(map(int, input().split('|')))
  2. text = input().split('@')
  3. points = 0
  4.  
  5. while text[0] != 'Game over':
  6. command = text[0]
  7. if command == 'Shoot Left':
  8. start_index = int(text[1])
  9. length = int(text[2])
  10. if 0 <= start_index < len(targets):
  11. if (start_index - length) < 0:
  12. current_index = (start_index - length) % len(targets)
  13. else:
  14. current_index = start_index - length
  15. if targets[current_index] >= 5:
  16. targets[current_index] -= 5
  17. points += 5
  18. elif 0 < targets[current_index] < 5:
  19. points += targets[current_index]
  20. targets[current_index] = 0
  21. elif command == 'Shoot Right':
  22. start_index = int(text[1])
  23. length = int(text[2])
  24. if 0 <= start_index < len(targets):
  25. if start_index + length > len(targets):
  26. current_index = (start_index + length) % len(targets)
  27. else:
  28. current_index = start_index + length
  29. if targets[current_index] >= 5:
  30. targets[current_index] -= 5
  31. points += 5
  32. elif 0 < targets[current_index] < 5:
  33. points += targets[current_index]
  34. targets[current_index] = 0
  35. elif command == 'Reverse':
  36. targets = targets[:: -1]
  37. text = input().split('@')
  38. print(' - '.join(str(i) for i in targets))
  39. print(f'Iskren finished the archery tournament with {points} points!')
Add Comment
Please, Sign In to add comment