Exemple #1
0
        public void OptimalFlipsBigDataSet(int down)
        {
            var pancakeStack = new PancakeStack(new String('-', down));

            var flipFinder = new FlipFinder();

            var bestStack = flipFinder.FindOptimalStack(new List <PancakeStack> {
                pancakeStack
            });
        }
Exemple #2
0
        public void BenchmarkTest02()
        {
            var longString   = "---------------+--------------------------------+---------------+---------++++--------+-----------+---";
            var pancakeStack = new PancakeStack(longString);

            var flipFinder = new FlipFinder();

            var bestStack = flipFinder.FindOptimalStack(new List <PancakeStack> {
                pancakeStack
            });
        }
Exemple #3
0
        public void OptimalFlips(string input, int expectedDepth)
        {
            var pancakeStack = new PancakeStack(input);

            var flipFinder = new FlipFinder();

            var bestStack = flipFinder.FindOptimalStack(new List <PancakeStack> {
                pancakeStack
            });

            Assert.IsNotNull(bestStack);
            Assert.AreEqual(expectedDepth, bestStack.Depth);
        }
Exemple #4
0
        public static void ProcessCases(IEnumerable <RevengeOfThePancakesCase> cases)
        {
            foreach (var revengeOfThePancakesCase in cases)
            {
                var pancakeStack = new PancakeStack(revengeOfThePancakesCase.Input);

                var flipFinder = new FlipFinder();

                var bestStack = flipFinder.FindOptimalStack(new List <PancakeStack> {
                    pancakeStack
                });
                revengeOfThePancakesCase.Output = bestStack.Depth.ToString();
            }
        }
Exemple #5
0
        public void OptimalFlipsBigDataSet(int down, int up)
        {
            string setup = new String('-', down) + new String('+', up);
            Random rnd   = new Random();

            var mixed       = setup.OrderBy(x => rnd.Next()).ToArray();
            var mixedString = new string(mixed);

            Console.WriteLine(mixedString);
            var pancakeStack = new PancakeStack(mixedString);

            var flipFinder = new FlipFinder();

            var bestStack = flipFinder.FindOptimalStack(new List <PancakeStack> {
                pancakeStack
            });
        }