static void Main(string[] args) { decimal sum = ComputeModuleSum(); Console.WriteLine($"Module sum: {sum}"); Intcode intcode = ComputeIntCode(); Console.WriteLine($"Intcode: {intcode.Compute()}"); for (var i = 0; i <= 99; i++) { for (var j = 0; j <= 99; j++) { intcode.Reset(); intcode.Intcodes[1] = i; intcode.Intcodes[2] = j; int output = intcode.Compute(); if (output == 19690720) { int nounVerb = 100 * i + j; Console.WriteLine($"Noun + Verb: {nounVerb}"); break; } } } int closestIntersection = ComputeClosestIntersection(); Console.WriteLine($"Closest intersection: {closestIntersection}"); Console.ReadLine(); }
public void ItExists() { int[] intcodes = new int[] { 1, 0, 0, 3, 99 }; var intcode = new Intcode(intcodes); int result = intcode.Compute(); }
public void GivenAnAddSetOfOpcodeShouldReturnValuesOfTwo() { // Arrange int[] intcodes = new int[] { 1, 0, 0, 3, 99 }; var intcode = new Intcode(intcodes); // Act int result = intcode.Compute(); // Assert Assert.Equal(2, result); }
public void GivenAnAddComplexSetOfOpcodeShouldReturnValuesOf3500() { // Arrange int[] intcodes = new int[] { 1, 9, 10, 3, 2, 3, 11, 0, 99, 30, 40, 50 }; var intcode = new Intcode(intcodes); // Act int result = intcode.Compute(); // Assert Assert.Equal(3500, result); }
public void GivenAnEmptyOpcodeSetShouldReturnValuesOfZero() { // Arrange int[] intcodes = new int[] { 99 }; var intcode = new Intcode(intcodes); // Act int result = intcode.Compute(); // Assert Assert.Equal(0, result); }