public static void Drawgird(int [,] grid, Grid g, List <Cell> list)
        {
            int i = 0;
            int j = 0;

            foreach (Cell p in list)
            {
                grid[i, j] = p.KindOfCell();
                j++;
                if (j == g.N)
                {
                    j = 0; i++;
                }
            }


            GridUtility.DrawGrid(grid);
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);

            int[,] grid = { {  1, 1,  0,  1,  0 },
                            { -1, 0,  0,  0,  0 },
                            {  1, 1, -1, -1, -1 },
                            {  1, 0,  1,  1,  1 },
                            {  1, 0,  0, -1,  0 } };

            GridUtility.DrawGrid(grid);
            Console.ReadKey();

            Console.Clear();
            int[,] grid1 = { { 1, -1, 0, -1,  0 },
                             { 0,  0, 0,  0,  0 },
                             { 1,  1, 1, -1,  1 },
                             { 1, -1, 1,  1,  1 },
                             { 1,  0, 0,  0, -1 } };

            GridUtility.DrawGrid(grid1);
            Console.ReadKey();

            Console.Clear();
            int[,] grid2 = new int[50, 50];

            for (int i = 0; i < 50; i++)
            {
                for (int j = 0; j < 50; j++)
                {
                    grid2[i, j] = 1;
                }
            }

            GridUtility.DrawGrid(grid2);

            Console.ReadKey();
        }