コード例 #1
0
        /// <summary>
        /// Parses a series
        /// </summary>
        /// <param name="instructions"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public IReadOnlyList <RelativeInstruction> ParseRawInstructions(string instructions)
        {
            // Input checking.
            if (instructions == null)
            {
                throw new ArgumentNullException(nameof(instructions));
            }

            var currentDirections = new List <RelativeInstruction>();

            string[] splitString = instructions.Split(Delimiter);

            foreach (string split in splitString)
            {
                currentDirections.Add(InstructionParser.ParseSingleInstruction(split));
            }

            return(currentDirections.AsReadOnly());
        }