Exemplo n.º 1
0
        public string Exchange(ReadOnlySpan <char> input, string baseLine)
        {
            var target = new Dance(baseLine);

            if (input.Length > 0)
            {
                target.Exchange(input.Slice(1));
            }
            else
            {
                target.Exchange(input);
            }
            return(target.Result());
        }
Exemplo n.º 2
0
        private void DanceSingle(Dance dance, string[] moves)
        {
            foreach (string move in moves)
            {
                switch (move[0])
                {
                case 's':
                {
                    dance.Spin(int.Parse(move.Substring(1)));
                    break;
                }

                case 'x':
                {
                    string[] p = move.Substring(1).Split("/");
                    dance.Exchange(int.Parse(p[0]), int.Parse(p[1]));
                    break;
                }

                case 'p':
                {
                    string[] p = move.Substring(1).Split("/");
                    dance.Partner(p[0][0], p[1][0]);
                    break;
                }
                }
            }
        }