Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            char[,] matrix = new char[, ]
            {
                { '*', '*', '*', '*', '*', '*' },
                { '*', 'x', 'x', '*', 'x', '*' },
                { '*', '*', '*', '*', 'x', '*' },
                { '*', 'x', 'x', '*', 'x', '*' },
                { '*', 'x', 'x', '*', 'x', '*' },
                { '*', '*', '*', '*', '*', '*' },
            };

            while (true)
            {
                var lab = new Labirint(matrix);
                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());
                lab.FindPaths(startRow, startCol, endRow, endCol, 'S');
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            char[,] matrix = new char[,]
            {
                { '*', '*', '*', '*', '*', '*' },
                { '*', 'x', 'x', '*', 'x', '*' },
                { '*', '*', '*', '*', 'x', '*' },
                { '*', 'x', 'x', '*', 'x', '*' },
                { '*', 'x', 'x', '*', 'x', '*' },
                { '*', '*', '*', '*', '*', '*' },
            };

            while (true)
            {
                var lab = new Labirint(matrix);
                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());
                lab.FindPaths(startRow, startCol, endRow, endCol, 'S');
            }
        }