using System;
namespace helloWorld {
public class FindingWay {
int min = 99999;
public int Min {
get { return min; }
}
int[, ] data, book;
int[, ] next = new int[4, 2] { { 0, 1 }, { 1, 0 }, { 0, -1 }, {-1, 0 } };
int h, w, edge, head, tail, flag;
struct node {
public int x;
public int y;
public int step;
};
public void Play (int tump, int x, int y, int hight, int wight) {
h = hight;
w = wight;
edge = tump - 1;
head = tail = 0;
SetMap (tump);
Console.WriteLine ("===开始深度优先搜索===");
Dfs (x, y, 0);
Console.WriteLine ("最小步数为: {0}", Min);
Console.WriteLine ("===开始广度优先搜索===");
Bfs (tump, x, y, 0);
}
C# 寻路,深度优先和广度优先
最新推荐文章于 2024-07-04 21:06:46 发布