viligen

bombs

Feb 6th, 2022
904
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.50 KB | None | 0 0
  1. from collections import deque
  2. bombs_template = {40: 'Datura Bombs', 60: 'Cherry Bombs', 120: 'Smoke Decoy Bombs'}
  3. bombs_made = {"Cherry Bombs": 0, "Datura Bombs": 0, "Smoke Decoy Bombs": 0}
  4.  
  5. bombs_effect_que = deque([int(n) for n in input().split(', ')])
  6. bombs_casing_stack = [int(n) for n in input().split(', ')]
  7.  
  8. while (bombs_effect_que and bombs_casing_stack) and (bombs_made["Cherry Bombs"] < 3 or bombs_made["Datura Bombs"] < 3
  9.                                                      or bombs_made["Smoke Decoy Bombs"] < 3):
  10.     current_bomb_effect = bombs_effect_que[0]
  11.     current_casing = bombs_casing_stack[-1]
  12.     current_sum = current_bomb_effect + current_casing
  13.     if current_sum in bombs_template:
  14.         bombs_made[bombs_template[current_sum]] += 1
  15.         bombs_effect_que.popleft()
  16.         bombs_casing_stack.pop()
  17.         continue
  18.     bombs_casing_stack[-1] -= 5
  19.  
  20. if bombs_made["Cherry Bombs"] >= 3 and bombs_made["Datura Bombs"] >= 3 and bombs_made["Smoke Decoy Bombs"] >= 3:
  21.     print("Bene! You have successfully filled the bomb pouch!")
  22. else:
  23.     print("You don't have enough materials to fill the bomb pouch.")
  24. if not bombs_effect_que:
  25.     print("Bomb Effects: empty")
  26. else:
  27.     print(f"Bomb Effects: {', '.join([str(n) for n in bombs_effect_que])}")
  28. if not bombs_casing_stack:
  29.     print("Bomb Casings: empty")
  30. else:
  31.     print(f"Bomb Casings: {', '.join([str(n) for n in bombs_casing_stack])}")
  32.  
  33. for bomb_type, count in sorted(bombs_made.items()):
  34.     print(f"{bomb_type}: {count}")
  35.  
Advertisement
Add Comment
Please, Sign In to add comment