public bool Star2_Tests(string input) { _parsedInput = _parser.Parse(new[] { input }); var solution = _solver.Star2(_parsedInput); Console.WriteLine(solution); return(solution == 1); }
public void Star2() { _input = FileHelpers.Read(_filePath); _parsedInput = _parser.Parse(_input); var solution = _solver.Star2(_parsedInput); Console.WriteLine(solution); Assert.AreEqual(275, solution); }
public int Example1(string inp) { var inputStr = new[] { inp }; var input = new Day2Input().Parse(inputStr); var solution = _solver.Star1(input); Console.WriteLine(solution); return(solution); }
public void Star2() { var fileInput = File.Read(); var input = new Day2Input().Parse(fileInput); var solution = _solver.Star2(input); Console.WriteLine(solution); Assert.Pass(); Assert.AreEqual(7733, solution); }
public void Star1() { var fileInput = File.Read(); var input = new Day2Input().Parse(fileInput); input.Commands[1] = 12; input.Commands[2] = 2; var solution = _solver.Star1(input); Console.WriteLine(solution); Assert.AreEqual(4090689, solution); }
public void Day2Method() { var a = Day2Input.Split(',').Select(int.Parse).ToArray(); var i = 0; while (a[i] != 99) { if (a[i] == 1) { a[a[i + 3]] = a[a[i + 1]] + a[a[i + 2]]; } if (a[i] == 2) { a[a[i + 3]] = a[a[i + 1]] * a[a[i + 2]]; } i += 4; } TestContext.WriteLine(a[0].ToString()); }