GroZnik81

10_bread_factory_v3

Jan 2nd, 2021
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. events = input().split("|")
  2. ENERGY = 100
  3. COINS = 100
  4. gain_energy = 0
  5. total_energy = ENERGY - gain_energy
  6. profit = 0
  7. total_profit = COINS + profit
  8. counter = 0
  9. for even in events:
  10.  
  11.     ingredient = even.split("-")
  12.     even = ingredient[0]
  13.     number = ingredient[1]
  14.  
  15.     if even == "order":
  16.         profit += int(number)
  17.         gain_energy -= 30
  18.         if total_energy < 30:
  19.             print(f"You had to rest!")
  20.             gain_energy += 50
  21.             continue
  22.         # profit += int(number)
  23.         else:
  24.             print(f"You earned {number} coins.")
  25.  
  26.     elif even == "rest":
  27.         total_energy += int(number)
  28.         if total_energy > 100:
  29.             print(f"You gained 0 energy.")
  30.             print(f"Current energy: {ENERGY}.")
  31.             total_energy = ENERGY
  32.             # continue
  33.         else:
  34.             # gain_energy += int(number)
  35.             print(f"You gained {number} energy.")
  36.  
  37.  
  38.     else:
  39.         if total_profit >= int(number):
  40.             total_profit -= int(number)
  41.             print(f"You bought {even}.")
  42.         else:
  43.             print(f"Closed! Cannot afford {even}.")
  44.             break
  45.  
  46. if total_energy > gain_energy:
  47.     print(f"Current energy: {total_energy}.")
  48.     print("Day completed!")
  49.     print(f"Coins: {profit}")
  50.     print(f"Energy: {total_energy}")
  51. else:
  52.     print()
  53.  
RAW Paste Data