Пример #1
0
        static void Main(string[] args)
        {
            var nb = new NationsBuilder();

            while (true)
            {
                var input = Console.ReadLine().Split().ToList();

                switch (input[0])
                {
                case "Bender":
                    nb.AssignBender(input);
                    break;

                case "Monument":
                    nb.AssignMonument(input);
                    break;

                case "Status":
                    Console.WriteLine(nb.GetStatus(input[1]));
                    break;

                case "War":
                    nb.IssueWar(input[1]);
                    break;

                case "Quit":
                    Console.WriteLine(nb.GetWarsRecord());
                    Environment.Exit(0);
                    break;
                }
            }
        }
Пример #2
0
	static void Main()
	{
	    NationsBuilder.CreateNations();
	    string input;
	    while ((input = Console.ReadLine()) != "Quit")
	    {
		List<string> parameters = input.Split().ToList();
		string command = parameters[0];
		try
		{
		    switch (command.ToUpper())
		    {
			case "BENDER":
			    NationsBuilder.AssignBender(parameters);
			    break;
			case "MONUMENT":
			    NationsBuilder.AssignMonument(parameters);
			    break;
			case "STATUS":
			    string nationType = parameters[1];
			    Console.WriteLine(NationsBuilder.GetStatus(nationType));
			    break;
			case "WAR":
			    nationType = parameters[1];
			    NationsBuilder.IssueWar(nationType);
			    break;
		    }
		}
		catch (Exception exception)
		{
		    Console.WriteLine(exception.Message);
		}
	    }
	    Console.WriteLine(NationsBuilder.GetWarsRecord());
	}
Пример #3
0
        public static void Main()
        {
            var command = Console.ReadLine();
            var nationsBuilder = new NationsBuilder();

            while (command != "Quit")
            {
                var commandTokens = command.Split().ToList();
                var commandType = commandTokens[0];

                switch (commandType)
                {
                    case "Bender":
                        nationsBuilder.AssignBender(commandTokens);
                        break;
                    case "Monument":
                        nationsBuilder.AssignMonument(commandTokens);
                        break;
                    case "Status":
                        Console.WriteLine(nationsBuilder.GetStatus(commandTokens[1])); 
                        break;
                    case "War":
                        nationsBuilder.IssueWar(commandTokens[1]);
                        break;
                }

                command = Console.ReadLine();
            }
            Console.WriteLine(nationsBuilder.GetWarsRecord());
        }
Пример #4
0
        private static void InvokeCommand(NationsBuilder nationsBuilder, List <string> tokens, string command)
        {
            switch (command)
            {
            case "Bender":
                nationsBuilder.AssignBender(tokens);
                break;

            case "Monument":
                nationsBuilder.AssignMonument(tokens);
                break;

            case "Status":
                Console.WriteLine(nationsBuilder.GetStatus(tokens[0]));
                break;

            case "War":
                nationsBuilder.IssueWar(tokens[0]);
                break;
            }
        }