예제 #1
0
        static void Main(string[] args)
        {
            int depth = 4;

            if (args.Any())
            {
                if (!int.TryParse(args[0], out depth))
                {
                    Console.WriteLine("Please provide a valid depth value");
                    return;
                }
            }

            if (depth == 0)
            {
                Console.WriteLine("Please provide a valid depth value");
                return;
            }
            Console.WriteLine("Depth parameter: " + depth);
            var branchSystem = new BranchSystem(depth);
            var predictEmptyContainerName = branchSystem.PredictEmptyContainer();
            var emptyContainerName        = branchSystem.RunBalls();

            Console.WriteLine("Predict Empty Container Name: " + predictEmptyContainerName);
            Console.WriteLine("Empty Container Name: " + emptyContainerName);
            if (predictEmptyContainerName == emptyContainerName)
            {
                Console.WriteLine("Predict success");
            }
            else
            {
                Console.WriteLine("Predict failed");
            }
        }
예제 #2
0
        public void TestBranchSystemDepth1()
        {
            var branchSystem = new BranchSystem.BranchSystem(1);

            Assert.Equal(2, branchSystem.LeafNodeCount);
            //set initial direction to left
            branchSystem.Tree.OpenDirection = GateDirection.Left;
            var expectEmptyContainerName  = "B";
            var predictEmptyContainerName = branchSystem.PredictEmptyContainer();
            var emptyContainerName        = branchSystem.RunBalls();

            output.WriteLine("Predict Empty Container Name: " + predictEmptyContainerName);
            output.WriteLine("Empty Container Name: " + emptyContainerName);
            Assert.NotEmpty(predictEmptyContainerName);
            Assert.NotEmpty(emptyContainerName);
            Assert.Equal(predictEmptyContainerName, emptyContainerName);
            Assert.Equal(expectEmptyContainerName, emptyContainerName);
        }