Pretorianbg

Untitled

Mar 4th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ConsoleApp1
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var quests = Console.ReadLine()
  11. .Split(", ")
  12. .ToList();
  13.  
  14. while (true)
  15. {
  16. string input = Console.ReadLine();
  17. if (input == "Retire!")
  18. {
  19. break;
  20. }
  21.  
  22. var command = input.Split(" - ").ToList();
  23.  
  24. if (command[0] == "Start" && !quests.Contains(command[1]))
  25. {
  26. quests.Add(command[1]);
  27. }
  28.  
  29. else if (command[0] == "Complete" && quests.Contains(command[1]))
  30. {
  31. quests.Remove(command[1]);
  32. }
  33.  
  34. else if (command[0] == "Side Quest")
  35. {
  36. var tokens = command[1].Split(":");
  37. var quest = tokens[0];
  38. var sideQuest = tokens[1];
  39.  
  40. if (quest.Contains(quest))
  41. {
  42. if (!quest.Contains(sideQuest))
  43. {
  44. int questIndex = quests.IndexOf(quest);
  45. quests.Insert(questIndex + 1, sideQuest);
  46. }
  47. }
  48. }
  49.  
  50. else if (command[0] == "Renew" && quests.Contains(command[1]))
  51. {
  52. quests.Remove(command[1]);
  53. quests.Add(command[1]);
  54. }
  55. }
  56.  
  57. Console.WriteLine(string.Join(", ", quests));
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment