Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var matrixSize = 76;
            char[,] bigMatrix = new char[matrixSize, matrixSize];
            int brickInitRation = 5;
            InitMatrix(bigMatrix, brickInitRation);
            char[,] copy = new char[matrixSize, matrixSize];
            CopyArray(bigMatrix, copy);
            PrintMatrix(copy);

            while (true)
            {
                CopyArray(bigMatrix, copy);
                var lab = new Labirint(copy);
                int startRow;
                Console.Write("Start row: ");
                startRow = int.Parse(Console.ReadLine());
                int startCol;
                Console.Write("Start col: ");
                startCol = int.Parse(Console.ReadLine());
                int endRow;
                Console.Write("End row: ");
                endRow = int.Parse(Console.ReadLine());
                int endCol;
                Console.Write("End col: ");
                endCol = int.Parse(Console.ReadLine());
                Console.WriteLine("Is Path: {0}", lab.FindPaths(startRow, startCol, endRow, endCol, 'S'));
                PrintMatrixColored(copy);
                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            var matrixSize = 76;

            char[,] bigMatrix = new char[matrixSize, matrixSize];
            int brickInitRation = 5;

            InitMatrix(bigMatrix, brickInitRation);
            char[,] copy = new char[matrixSize, matrixSize];
            CopyArray(bigMatrix, copy);
            PrintMatrix(copy);

            while (true)
            {
                CopyArray(bigMatrix, copy);
                var lab = new Labirint(copy);
                int startRow;
                Console.Write("Start row: ");
                startRow = int.Parse(Console.ReadLine());
                int startCol;
                Console.Write("Start col: ");
                startCol = int.Parse(Console.ReadLine());
                int endRow;
                Console.Write("End row: ");
                endRow = int.Parse(Console.ReadLine());
                int endCol;
                Console.Write("End col: ");
                endCol = int.Parse(Console.ReadLine());
                Console.WriteLine("Is Path: {0}", lab.FindPaths(startRow, startCol, endRow, endCol, 'S'));
                PrintMatrixColored(copy);
                Console.WriteLine();
            }
        }