Esempio n. 1
0
        public Commands words2()
        {
            String firstword, allwords, secondword;

            allwords = Console.ReadLine();
            String[] commArray;
            commArray = allwords.Split(' ');
            firstword = commArray[0];
            try
            {
                secondword = commArray[1];
            }
            catch (Exception e)
            {
                secondword = null;
            }
            if (CW.isvalid(firstword))
            {
                Commands newcom = new Commands(firstword, secondword);
                return(newcom);
            }
            else
            {
                Commands newcom = new Commands(firstword, secondword);
                return(newcom);
            }
        }
Esempio n. 2
0
        public static void parscom(CommandWords commandWords, Commands command)
        {
            if (commandWords.isvalid(command) == false)
            {
                Console.WriteLine("That is not a valid command.");
            }
            String CommandWord = command.getCommandWord();

            if (CommandWord == "walk")
            {
                walk(command);
            }
            if (CommandWord == "look")
            {
                look();
            }
            if (CommandWord == "take")
            {
                take();
            }
            if (CommandWord == "help")
            {
            }
        }