Пример #1
0
        //Rules for Swarm formations evolutions
        //Based on Game Of Life,
        //if difference between RED and BLUE

        public void PrintBf()
        {
            ConsoleColor defbg;


            Console.Write("Enter 0 for light mode 1 for Dark Mode: ");
            string mode = Console.ReadLine();

            if (mode == "0")
            {
                defbg = ConsoleColor.White;
            }
            else
            {
                defbg = ConsoleColor.Black;
            }

            cuim.PrintMatrix(
                "Battle Field", bf_global_view, bfOrder, bfOrder, new string[] { "R", "B" },
                ConsoleColor.Yellow, ConsoleColor.Black,
                defbg, ConsoleColor.White,
                new ConsoleColor[] { defbg, defbg },
                new ConsoleColor[] { ConsoleColor.Red, ConsoleColor.Blue }
                );
        }
Пример #2
0
        public void RunTests()
        {
            ConsoleUiManager cum = this;

            double r    = 10;
            double area = 2 * Math.PI * r;

            string[] sa = new string[2];

            //case-1
            sa[0] = "radius = " + r.ToString();
            sa[1] = "area = " + area.ToString();
            cum.PrintSimpleData("Simple Engineering Data", sa,
                                ConsoleColor.Red, ConsoleColor.White,
                                ConsoleColor.DarkYellow, ConsoleColor.Black);

            //case-2
            string[] h1 = new string[3];
            h1[0] = "name";
            h1[1] = "age";
            h1[2] = "salary";

            string[] d1 = new string[3];
            d1[0] = "so";
            d1[1] = "40";
            d1[2] = "100";

            cum.PrintLine(h1);
            cum.PrintLine(d1);

            //case-3
            string h2 = "product, quantity, price";

            string[] d2 = new string[2];
            d2[0] = "tv, 1, 25000";
            d2[1] = "charger, 3, 10000";
            cum.PrintTable("Table 1", h2, d2, ',',
                           ConsoleColor.Yellow, ConsoleColor.Black,
                           ConsoleColor.DarkMagenta, ConsoleColor.DarkYellow,
                           ConsoleColor.Green, ConsoleColor.White);

            //case-4a
            string[,] strmat = { { "0", "1", "2" }, { "3", "4", "5" }, { "6", "7", "8" } };
            cum.PrintMatrix("Simple Matrix", strmat, 3, 3,
                            ConsoleColor.Yellow, ConsoleColor.Black,
                            ConsoleColor.Blue, ConsoleColor.Cyan);

            //case-4b
            //string[,] intmat = { { "0", "1", "2" }, { "3", "4", "5" }, { "6", "7", "8" } };
            ConsoleColor cbg = ConsoleColor.Red;
            ConsoleColor cfg = ConsoleColor.Yellow;

            cum.PrintMatrix("Matrix with Multi Overwrites", strmat, 3, 3,
                            new string[] { "a", "b", "c" },
                            new int[] { 0, 1, 2 }, new int[] { 0, 1, 2 },
                            ConsoleColor.Yellow, ConsoleColor.Black,
                            ConsoleColor.DarkBlue, ConsoleColor.Yellow,
                            new ConsoleColor[] { cbg, cbg, cbg }, new ConsoleColor[] { cfg, cfg, cfg }
                            );

            //case-4c
            //string[,] intmat = { { "0", "1", "2" }, { "3", "4", "5" }, { "6", "7", "8" } };
            cbg = ConsoleColor.Red;
            cfg = ConsoleColor.Yellow;
            cum.PrintMatrix("Matrix with Single Overwrite", strmat, 3, 3,
                            "b", 1, 1,
                            ConsoleColor.Yellow, ConsoleColor.Black,
                            ConsoleColor.Black, ConsoleColor.White,
                            cbg, cfg, " ");

            //case-5
            cum.PrintHistogram("Histogram 1", new int[] { 3, 5, 7, 4, 2, 1 }, 9, '*',
                               ConsoleColor.Yellow, ConsoleColor.Black,
                               ConsoleColor.DarkBlue, cfg, "\t");


            //case-6
            cum.PrintLinePlot("Plot 1", new int[] { 3, 5, 7, 4, 2, 1 }, 9, '*',
                              ConsoleColor.Yellow, ConsoleColor.Black,
                              ConsoleColor.DarkMagenta, cfg, " ");
        }