本文介绍了求解[10,10]迷宫的递归算法。我不知道该怎么办算法请帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace chapterOneAssigment12
{
    class Program
    {
        // Declare array

        char[,] grid = new char[10, 10];

        static void Main(string[] args)
        {
            // Open file

            StreamReader input = new StreamReader("maze.txt");

            // Char Variable

            char value;

            // Junk String

            string junk;

            // Declare array

            char[,] grid = new char[10, 10];


            // Algorithm To read in maze

            for (int row = 0; row < 10; row++)
            {
                for (int column = 0; column < 10; column++)
                {
                    value = (char)input.Read();
                    grid[row, column] = value;
                }

                // Dump extra characters 

                junk = input.ReadLine();
            }

            input.Close();

            // Other Algorithm To read in maze  

            for (int row1 = 0; row1 < 10; row1++)
            {
                for (int column1 = 0; column1 < 10; column1++)
                {
                    Console.Write(grid[row1, column1]);
                }

                Console.WriteLine("");
            }

            MazeSolve(1, 1);

            // Display 

            StreamWriter output = new StreamWriter("maze.out");

            // Call the solve method


        }

        // Exit Found Method To Find the exit

        public static void MazeSolve( int row, int column)
        {
            // Declare boolean 

            bool exitFound;

            exitFound = false;

            if (row == 1)
            {
                exitFound = true;
            }
            else if (row == 9)
            {
                exitFound = true;
            }
            else if (column == 1)
            {
                exitFound = true;
            }
            else if (column == 9)
            {
                exitFound = true;
            }
            else
            {
                if (!exitFound && )
                {

                }
                if (!exitFound &&)
                {
                }
                if (!exitFound &&)
                {
                }
                if (!exitFound &&)
                {
                }
            }

            if (exitFound == true)
            {


            }

        }


    }
}

推荐答案



这篇关于求解[10,10]迷宫的递归算法。我不知道该怎么办算法请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 08:44
查看更多