Example #1
0
        static void Main(string[] args)
        {
            CPU                  cpu       = new CPU();
            FileInputReader      reader    = new FileInputReader();
            InstructionProcessor processor = new InstructionProcessor(cpu, reader);

            processor.ProcessInstructions("Inputs/day-8.txt");

            // Part one
            Console.WriteLine(processor.GetCurrentLargestValue());

            // Part two
            Console.WriteLine(processor.GetHistoricalLargestValue());
        }
        public void ProcessInstructions()
        {
            CPU cpu = new CPU();
            StringInputReader    reader    = new StringInputReader();
            InstructionProcessor processor = new InstructionProcessor(cpu, reader);

            string input = @"b inc 5 if a > 1
                a inc 1 if b < 5
                c dec -10 if a >= 1
                c inc -20 if c == 10";

            processor.ProcessInstructions(input);

            Assert.Equal(1, processor.GetCurrentLargestValue());
            Assert.Equal(10, processor.GetHistoricalLargestValue());
        }