Esempio n. 1
0
        public void ExampleTest()
        {
            var loader = new ExampleModelLoader();
            var model  = loader.LoadModel();
            var max    = ModelLogic.GetMaxSum(model, (n, c) => n.Value % 2 != c.Value % 2, out string path);

            Assert.AreEqual(16, max);
            Assert.AreEqual("1 -> 8 -> 5 -> 2", path);
        }
Esempio n. 2
0
 public static void Main(string[] args)
 {
     try
     {
         var loader = new FileTriangleTreeModelLoader <int>("..\\..\\..\\Exercise-1.txt");
         var model  = loader.LoadModel();
         var maxSum = ModelLogic.GetMaxSum(model, (n, c) => n.Value % 2 != c.Value % 2, out string path);
         Console.WriteLine($"Max sum = {maxSum}");
         Console.WriteLine($"Path = {path}");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     Console.WriteLine("Press any key to exit");
     Console.ReadKey();
 }