Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _03_QuestJournal
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> quests = Console.ReadLine().Split(", ").ToList();
- string input = Console.ReadLine();
- while (input != "Retire!")
- {
- List<string> commandParts = input.Split(" - ").ToList();
- string command = commandParts[0];
- if (command == "Start")
- {
- string questToAdd = commandParts[1];
- if (!quests.Contains(questToAdd))
- {
- quests.Add(questToAdd);
- }
- }
- else if (command == "Complete")
- {
- string questToRemove = commandParts[1];
- // ako nqmash element za premahvane kakvo stava
- if (quests.Contains(questToRemove))
- {
- quests.Remove(questToRemove);
- }
- }
- else if (command == "Side Quest")
- {
- List<string> parts = commandParts[1].Split(":").ToList();
- string quest = parts[0];
- string sideQuest = parts[1];
- if (quests.Contains(quest) && !quests.Contains(sideQuest))
- {
- int indexOfQuestToAddAt = quests.IndexOf(quest) + 1;
- quests.Insert(indexOfQuestToAddAt, sideQuest);
- }
- }
- else if (command == "Renew")
- {
- string questToChangeLast = commandParts[1];
- if (quests.Contains(questToChangeLast))
- {
- quests.Remove(questToChangeLast);
- quests.Add(questToChangeLast);
- }
- }
- input = Console.ReadLine();
- }
- Console.WriteLine(String.Join(", ", quests));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment