GroZnik81

10_bread_factory_v2

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.         if total_energy < 30:
  17.             print(f"You had to rest!")
  18.             gain_energy += 50
  19.             continue
  20.         profit += int(number)
  21.         if total_energy > 100:
  22.             total_energy = 100
  23.         total_energy -= 30
  24.         counter += 1
  25.         print(f"You earned {number} coins.")
  26.  
  27.     elif even == "rest":
  28.         total_energy += int(number)
  29.         if total_energy > 100:
  30.             print(f"You gained 0 energy.")
  31.             print(f"Current energy: {ENERGY}.")
  32.             total_energy = ENERGY
  33.             # continue
  34.         else:
  35.             # gain_energy += int(number)
  36.             print(f"You gained {number} energy.")
  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