Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] bombEffectsInput = Console.ReadLine().Split(", ").Select(int.Parse).ToArray();
- int[] bombCasingsInput = Console.ReadLine().Split(", ").Select(int.Parse).ToArray();
- Queue<int> bombEffects = new Queue<int>();
- Stack<int> bombCasing = new Stack<int>();
- Dictionary<string, int> bombs = new Dictionary<string, int>();
- int daturaBombs = 40;
- bombs["Datura Bombs"] = 0;
- int cherryBombs = 60;
- bombs["Cherry Bombs"] = 0;
- int smokeBombs = 120;
- bombs["Smoke Decoy Bombs"] = 0;
- foreach (var effect in bombEffectsInput)
- {
- bombEffects.Enqueue(effect);
- }
- foreach (var casing in bombCasingsInput)
- {
- bombCasing.Push(casing);
- }
- bool pouch = false;
- //------------------------------------
- while (bombCasing.Count > 0 && bombEffects.Count > 0)
- {
- int currentMix = bombCasing.Peek() + bombEffects.Peek();
- if (bombs["Cherry Bombs"] >= 3 && bombs["Datura Bombs"] >= 3 && bombs["Smoke Decoy Bombs"] >= 3)
- {
- pouch = true;
- break;
- }
- if (currentMix == cherryBombs)
- {
- bombs["Cherry Bombs"]++;
- bombCasing.Pop();
- bombEffects.Dequeue();
- }
- else if (currentMix == daturaBombs)
- {
- bombs["Datura Bombs"]++;
- bombCasing.Pop();
- bombEffects.Dequeue();
- }
- else if (currentMix == smokeBombs)
- {
- bombs["Smoke Decoy Bombs"]++;
- bombCasing.Pop();
- bombEffects.Dequeue();
- }
- else
- {
- int temp = bombCasing.Pop();
- temp -= 5;
- bombCasing.Push(temp);
- }
- }
- //--------------------------
- if (pouch)
- {
- Console.WriteLine("Bene! You have successfully filled the bomb pouch!");
- }
- else
- {
- Console.WriteLine("You don't have enough materials to fill the bomb pouch.");
- }
- //--------------------------
- if (bombEffects.Count > 0)
- {
- Console.WriteLine($"Bomb Effects: {string.Join(", ",bombEffects)}");
- }
- else
- {
- Console.WriteLine("Bomb Effects: empty");
- }
- //--------------------------
- if (bombCasing.Count > 0)
- {
- Console.WriteLine($"Bomb Casings: {string.Join(", ", bombCasing)}");
- }
- else
- {
- Console.WriteLine("Bomb Casings: empty");
- }
- Console.WriteLine($"Cherry Bombs: {bombs["Cherry Bombs"]}");
- Console.WriteLine($"Datura Bombs: {bombs["Datura Bombs"]}");
- Console.WriteLine($"Smoke Decoy Bombs: {bombs["Smoke Decoy Bombs"]}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement