示例#1
0
        public static Card[] Parse(string input)
        {
            int id = 0;

            return(input.Split(' ')
                   .Skip(5)
                   .Select(card => {
                var color = ColorParser.Parse(card [0].ToString());
                var rank = byte.Parse(card [1].ToString());
                return new Card(color, rank, id++);
            }).ToArray());
        }
示例#2
0
        static MoveInfo ParseTellCommands(string[] commandParts)
        {
            byte rank       = 0;
            var  appliedFor = commandParts.Skip(5).Select(x => byte.Parse(x)).ToArray();
            bool isNumber   = byte.TryParse(commandParts [2], out rank);

            if (isNumber)
            {
                return(new TellRankInfo(appliedFor, rank));
            }
            else
            {
                var color = ColorParser.Parse(commandParts [2]);
                return(new TellColorInfo(appliedFor, color));
            }
        }