public void TestFindGreedyPath(string layout, string expectedPath) { var layoutRows = layout.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); var robot = new SimulationRobot(layoutRows); var path = string.Join(',', robot.FindGreedyPath()); Assert.AreEqual(expectedPath, path); }
//Works if the routine doesn't require changing patterns on a straight section i.e. covering R12L8 with R6 + 6L8 protected override void SolvePartTwo() { var testrobot = new SimulationRobot(scaffoldImageRows); var greedyPath = testrobot.FindGreedyPath(); var routine = FindValidMovementRoutine(greedyPath, new List <string> [0], new int[0]); var robot = new ASCIIComputer(program); resultPartTwo = routine.UploadToASCIIComputer(robot); }
public void TestFindValidRoutine(string layout) { var layoutRows = layout.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); var robot = new SimulationRobot(layoutRows); var path = robot.FindGreedyPath(); var routine = Solver.FindValidMovementRoutine(path, new List <string> [0], new int[0]); Assert.IsTrue(routine.TryMainRoutine(robot)); }