Exemplo n.º 1
0
        private static RegistersCollection SolveCore(string input)
        {
            var lines     = input.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            var registers = new RegistersCollection();

            var instructionParser = new InstructionParser(registers);
            var instructions      = lines.Select(instructionParser.Parse).ToList();

            instructions.ForEach(i => i.Execute());

            return(registers);
        }
 public InstructionFactory(RegistersCollection registers)
 {
     this.registers = registers;
 }
 public Instruction(RegistersCollection registers)
 {
     this.registers = registers ?? throw new ArgumentNullException(nameof(registers));
 }
Exemplo n.º 4
0
 public InstructionParser(RegistersCollection registers)
 {
     this.registers = registers;
 }