Exemplo n.º 1
0
        private long GetOrderAfterMoves(int numberOfIterations)
        {
            var crabCupGame = new CrabCupGame(_cards, false);

            while (numberOfIterations-- > 0)
            {
                crabCupGame.Move();
            }

            var order = crabCupGame.Order().Aggregate(0L, (a, d) => 10 * a + d);

            return(order);
        }
Exemplo n.º 2
0
        private long ProductOfCupsNextToCupOne(int numberOfIterations)
        {
            var crabCupGame = new CrabCupGame(_cards, true);

            while (numberOfIterations-- > 0)
            {
                crabCupGame.Move();
            }

            var cupOne = crabCupGame.Items[1];

            var a = (long)cupOne.Next.Item;
            var b = (long)cupOne.Next.Next.Item;

            return(a * b);
        }