Exemple #1
0
        public static void DoDay8()
        {
            string inputstring;
            int    answer = 0;

            inputstring = System.IO.File.ReadAllText(@".\Input\DayEightInput.txt");
            CodeSegment Game = new CodeSegment(inputstring);

            answer = Game.Execute();
            System.Console.WriteLine("Accumulator ended at: {0}", answer);
        }
Exemple #2
0
 public void Execute(CodeSegment cs)
 {
     if (this.command == Constants.NOP)
     {
         cs.Index++;
     }
     else if (this.command == Constants.ACC)
     {
         cs.Index++;
         cs.Add(this.value);
     }
     else if (this.command == Constants.JMP)
     {
         cs.Index += value;
     }
     this.executed = true;
 }