迷宫探路III(最短路径)

来源:百度知道 编辑:UC知道 时间:2024/06/02 18:17:49
将从迷宫入口到各点的最短路近的集合看作一棵树。用广度遍历
的方法即可找到出口的最短路近。本程序算法思想来源于求图上一点
到其余各点最短路近的Dijkstra算法。

高手帮忙做个流程图

/* 迷宫探路III(最短路径)*/
/* DIJKSTRAMAZE.C */
/* 2003-8-26 */
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <graphics.h>
#define N 22
#define M 22
int bg[M][N];
int aa[M][N];
struct pace{
int pre;
int x;
int y;
int ri;
int rj;
}road[M*N];
struct pace bestroad[M*N];

void makebg(int,int);
void drawbg(int[][],int,int,int,int,int);
void drawman(int,int,int);
void rect(int,int,int,int);
void main(){/* main()开始 */
int step=20;
int len=10;
int size=20;
int x=0,y=0;
int i=0,j=0;
int gdriver=DETECT,gmode;
char ch;
int direc;
int routelen=0;
int dj[]={-1,1,0,0};
int di[]={0,0,-1,1};
int begin;
int end;
int k;
int t;
int num;
int suc;
int cnt;
int x0;