private static void SolveTheProblem(int problemNr) { Console.WriteLine($"Solving Euler problem: {problemNr}"); var watch = System.Diagnostics.Stopwatch.StartNew(); IPyramideController pyramid = new PyramidController(GetInputValues(problemNr)); IPathController pathController = new PathController(pyramid); var path = pathController.GetSuitablePath(); watch.Stop(); Console.WriteLine("Result: " + path.Sum); var output = "Path -> "; for (var i = 0; i < path.PathNodes.Count; i++) { output += path.PathNodes[i].Value; if (i < path.PathNodes.Count - 1) { output += " + "; } } output += $" = {path.Sum}"; Console.WriteLine(output); Console.WriteLine($"It tooked: {watch.ElapsedMilliseconds}ms"); Console.WriteLine("-----------------------------------------\n"); }
public void MatrixController_CreateCorrectValuedNodes_CorrectValue() { var controller = new PyramidController(Input); Assert.AreEqual(Input[0], controller.Nodes[0].Value); Assert.AreEqual(Input[1], controller.Nodes[1].Value); Assert.AreEqual(Input[2], controller.Nodes[2].Value); }
public void MatrixController_CreateCorrectIndexedNodes_CorrectIndex() { var controller = new PyramidController(Input); Assert.AreEqual(0, controller.Nodes[0].Index); Assert.AreEqual(1, controller.Nodes[1].Index); Assert.AreEqual(2, controller.Nodes[2].Index); }
private void InitXrTypes() { var typeDic = new Dictionary <XrType, IXrController>(); IXrController xrController = new VrManualController(); typeDic[xrController.GetType()] = xrController; xrController = new VrGlassController(); typeDic[xrController.GetType()] = xrController; xrController = new VrSingleController(); typeDic[xrController.GetType()] = xrController; xrController = new PyramidController(); typeDic[xrController.GetType()] = xrController; xrController = new CameraFileController(); typeDic[xrController.GetType()] = xrController; xrController = new ArUserDefinedController(); typeDic[xrController.GetType()] = xrController; _xrControllers = typeDic; }
public void MatrixController_CreatesNodes_correctAmount() { var controller = new PyramidController(Input); Assert.AreEqual(Input.Length, controller.Nodes.Count); }