Advertisement
Guest User

Archery Tournament #Python

a guest
Feb 27th, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 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. current_index = len(targets) - ((start_index + length) % len(targets))
  11. if 0 <= start_index < len(targets):
  12. if targets[current_index] >= 5:
  13. targets[current_index] -= 5
  14. points += 5
  15. elif 0 < targets[current_index] < 5:
  16. points += targets[current_index]
  17. targets[current_index] = 0
  18. elif command == 'Shoot Right':
  19. start_index = int(text[1])
  20. length = int(text[2])
  21. current_index = (start_index + length) % len(targets)
  22. if 0 <= start_index < len(targets):
  23. if targets[current_index] >= 5:
  24. targets[current_index] -= 5
  25. points += 5
  26. elif 0 < targets[current_index] < 5:
  27. points += targets[current_index]
  28. targets[current_index] = 0
  29. elif command == 'Reverse':
  30. targets = targets[:: -1]
  31. text = input().split('@')
  32.  
  33. print(' - '.join(str(i) for i in targets))
  34. print(f'Iskren finished the archery tournament with {points} points!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement