コード例 #1
0
        public void Test1()
        {
            var g      = new MagicSquareGenerator();
            var result = g.Generate(4);

            Assert.True(result.Any());
        }
コード例 #2
0
        private static void Main(string[] args)
        {
            /*
             * In this example MagicSquareGenerator is a Facade on the complex
             * operation of generating a square matrix of magic number.
             */
            var msg    = new MagicSquareGenerator();
            var matrix = msg.Generate(2);

            WriteLine("Magic square generated.");
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var magicSquareGenerator = new MagicSquareGenerator();
            var magicSquare          = new List <List <int> >();
            var size = 4;

            magicSquare = magicSquareGenerator.Generate(size);

            foreach (var list in magicSquare)
            {
                foreach (var num in list)
                {
                    Console.Write($"{num} ");
                }

                Console.WriteLine();
            }
        }