Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- var quests = Console.ReadLine()
- .Split(", ")
- .ToList();
- while (true)
- {
- string input = Console.ReadLine();
- if (input == "Retire!")
- {
- break;
- }
- var command = input.Split(" - ").ToList();
- if (command[0] == "Start")
- {
- if (!quests.Contains(command[1]))
- {
- quests.Add(command[1]);
- }
- }
- else if (command[0] == "Complete")
- {
- if (quests.Contains(command[1]))
- {
- quests.Remove(command[1]);
- }
- }
- else if (command[0] == "Side Quest")
- {
- var tokens = command[1].Split(":").ToArray();
- string currentQuest = tokens[0];
- string sideQuest = tokens[1];
- if (quests.Contains(currentQuest))
- {
- if (!quests.Contains(sideQuest))
- {
- var currentQuestLocation = quests.IndexOf(currentQuest);
- quests.Insert(currentQuestLocation+1, sideQuest);
- }
- }
- }
- else if (command[0] == "Renew")
- {
- if (quests.Contains(command[1]))
- {
- quests.Remove(command[1]);
- quests.Insert(quests.Count, command[1]);
- }
- }
- }
- Console.WriteLine(string.Join(", ", quests));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment