示例#1
0
        public void SolveDayTwo()
        {
            string resultsFile = "adventDayTwoSolution.txt";
            string dataFile    = "adventDayTwo.txt";
            string outFile     = Path.Combine(baseDir, resultsFile);
            string inFile      = Path.Combine(baseDir, dataFile);

            string[] sourceData = ReadAllLines(inFile);
            // should be one line
            IntComputer newComp = new IntComputer();

            newComp.InitializeMemoryFromFile(inFile);

            // we need to find the values that give us 19690720 in address 0 after running. Reset each time.
            if (FindNounVerb(newComp))
            {
                newComp.WriteMemoryToFile(outFile);
                long val = 100 * newComp.ReadMemoryAtAddress(1) + newComp.ReadMemoryAtAddress(2);
            }
            else
            {
                Console.WriteLine("FAIL");
            }

            //19690720
        }
示例#2
0
        public void SolveDayFive()
        {
            string resultsFile = "adventDayFiveSolution.txt";
            string dataFile    = "adventDayFive.txt";
            string outFile     = Path.Combine(baseDir, resultsFile);
            string inFile      = Path.Combine(baseDir, dataFile);

            string[] sourceData = ReadAllLines(inFile);
            // should be one line
            IntComputer newComp = new IntComputer();

            newComp.InitializeMemoryFromFile(inFile);
            newComp.AddInputData(5);
            newComp.StartComputer(false);
            newComp.WriteMemoryToFile(outFile);
        }