public int Execute(int currentInstructionIndex)
        {
            var instructionParts = _instruction.Split(' ');
            var valueToCopy      = InstructionExtensions.GetIntValueOrValueOfRegister(instructionParts[1], _registers);
            var register         = Convert.ToChar(instructionParts[2]);

            _registers[register] = valueToCopy;
            return(currentInstructionIndex + 1);
        }
Exemple #2
0
        public int Execute(int currentInstructionIndex)
        {
            var values            = _instruction.Split(' ');
            var intValueToCompare = InstructionExtensions.GetIntValueOrValueOfRegister(values[1], _registers);
            var indexesToMove     = int.Parse(values[2]);

            if (intValueToCompare != 0)
            {
                return(currentInstructionIndex + indexesToMove);
            }

            return(currentInstructionIndex + 1);
        }