public void Part1_Exemple1_DistancesGrid() { var grid = InputParser.ParseBoolGrid(Exemple1Grid, '\n', '#'); var expected = new int[, ] { { 0, 7, 0, 0, 7 }, { 0, 0, 0, 0, 0 }, { 6, 7, 7, 7, 5 }, { 0, 0, 0, 0, 7 }, { 0, 0, 0, 8, 7 } }; Assert.AreEqual(expected, Day10Main.AsteroidToDistanceGrid(grid)); }
public void Part2_Exemple1Grid() { var grid = InputParser.ParseBoolGrid(Part2Exemple1.Replace("\r", ""), '\n', '#'); var exected = new int[, ] { { 0, 26, 0, 0, 0, 0, 29, 30, 31, 2, 4, 0, 0, 0, 33, 0, 0 }, { 23, 24, 0, 0, 0, 27, 28, 0, 1, 3, 32, 6, 7, 0, 0, 9, 34 }, { 21, 22, 0, 0, 0, 25, 0, 0, 0, 5, 0, 8, 10, 11, 12, 13, 0 }, { 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 35, 36, 0, 0 }, { 0, 0, 19, 0, 18, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 16, 15 } }; var actual = Day10Main.AsteroidToDestructionOrderGrid(grid, new Vector2Int(8, 3)); Debug.Log(TestUtility.GridToPrintableString <int>(actual)); TestUtility.AreEqual(exected, actual); }
private void CreateTaskForDay(int currentDay) { var input = AOCInput.GetInput(currentDay); if (currentDay == 1) { CreateTask(() => Day1Main.Part1(input), () => Day1Main.Part2(input)); Day1Main.StartPart1ComputeShader(input); } else if (currentDay == 2) { CreateTask(() => Day2Main.Part1(input), () => Day2Main.Part2(input)); } else if (currentDay == 3) { CreateTask(() => Day3Main.Part1(input) + "", () => Day3Main.Part2(input) + ""); } else if (currentDay == 4) { CreateTask(() => Day4Main.Part1(input) + "", () => Day4Main.Part2(input) + ""); } else if (currentDay == 5) { CreateTask(() => Day5Main.Part1(input) + "", () => Day5Main.Part2(input) + ""); } else if (currentDay == 6) { CreateTask(() => Day6Main.Part1(input) + "", () => Day6Main.Part2(input) + ""); } else if (currentDay == 7) { CreateTask(() => Day7Main.Part1(input) + "", () => Day7Main.Part2(input) + ""); } else if (currentDay == 8) { CreateTask(() => Day8Main.Part1(input) + "", () => Day8Main.Part2(input) + ""); } else if (currentDay == 9) { CreateTask(() => Day9Main.Part1(input) + "", () => Day9Main.Part2(input) + ""); } else if (currentDay == 10) { CreateTask(() => Day10Main.Part1(input) + "", () => Day10Main.Part2(input) + ""); } else if (currentDay == 11) { CreateTask(() => Day11Main.Part1(input) + "", () => Day11Main.Part2(input) + ""); } else if (currentDay == 12) { CreateTask(() => Day12Main.Part1(input) + "", () => Day12Main.Part2(input) + ""); } else if (currentDay == 13) { CreateTask(() => Day13Main.Part1(input) + "", () => Day13Main.Part2(input) + ""); } else if (currentDay == 14) { CreateTask(() => Day14Main.Part1(input) + "", () => Day14Main.Part2(input) + ""); } else if (currentDay == 15) { CreateTask(() => Day15Main.Part1(input) + "", () => Day15Main.Part2(input) + ""); } }
public void Part2_Exemple2() { Assert.AreEqual(802, Day10Main.Part2(BigExemple, 11, 13)); }
public void Part2_Exemple1Answer() { Assert.AreEqual(1403, Day10Main.Part2(Part2Exemple1, 8, 3)); }
public void Part1_Exemple4_Has41() { Assert.AreEqual(41, Day10Main.Part1(Exemple4Grid)); }
public void Part1_Exemple3_Has35() { Assert.AreEqual(35, Day10Main.Part1(Exemple3Grid)); }
public void Part1_Exemple2_Has33() { Assert.AreEqual(33, Day10Main.Part1(Exemple2Grid)); }
public void Part1_Exemple1_Has8() { Assert.AreEqual(8, Day10Main.Part1(Exemple1Grid)); }
public void Part1_AngleTest_LeftIs270() => Assert.AreEqual(270, Day10Main.AngleBetween(2, 1, 0, 1), 0.001f);
public void Part1_AngleTest_UpIs0() => Assert.AreEqual(0, Day10Main.AngleBetween(0, 2, 0, 1), 0.001f);
public void Part1_AngleTest_RightIs90() => Assert.AreEqual(90, Day10Main.AngleBetween(0, 1, 2, 1), 0.001f);
public void Part1_AngleTest_DownIs180() => Assert.AreEqual(180, Day10Main.AngleBetween(0, 1, 0, 4), 0.001f);