Pretorianbg

Untitled

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