Ejemplo n.º 1
0
        public void Parse_ComboInstruction_Player2Points3()
        {
            var act = Instruction.Parse("update player2 combo 3");
            var exp = new ComboInstruction(PlayerName.Player2, 3);

            Assert.AreEqual(exp, act);
        }
Ejemplo n.º 2
0
        private ComboInstruction GetComboInstruction(CharReader cr)
        {
            var newInstruction = new ComboInstruction();

            while (cr.HasCharacters())
            {
                var c = cr.GetChar();

                if (c == '[' || c == ']' || c == '.' || c == ',')
                {
                    break;
                }

                if (c == '+')
                {
                    newInstruction.Add();
                }
                if (c == '-')
                {
                    newInstruction.Subtract();
                }
                if (c == '<')
                {
                    newInstruction.ShiftLeft();
                }
                if (c == '>')
                {
                    newInstruction.ShiftRight();
                }

                cr.Forward();
            }

            cr.Back();

            return(newInstruction);
        }