- 5
- 0
- 约9.45千字
- 约 10页
- 2018-06-21 发布于河南
- 举报
可连通迷宫程序
#include stdafx.h
#include iostream
#include stdlib.h
#include stdio.h
#include time.h
#include math.h
#include Windows.h
#include queue
#define M 20
#define N 20
using namespace std;//曝光命名空间
typedef struct{
int r;//通道块的行坐标row
int c;//通道块的列坐标col
int di;//走向下一通道块的方向direction
int ord;//当前路径的序列号order
}PosType,Stack;//栈记录通道块的各元素
int dir[4][2] = { -1, 0, 1, 0, 0, -1, 0, 1 }; //临近的四个方向,表示和某点周围的横纵坐标差值
void InitStartEnd(PosType* start,PosType* end, int degree){
start-r=rand()%(M-3)+1;//随机入口从1---(M-3)
start-c=0;
start-di=1;
start-ord=0;
//随机入口
end-r=rand()%(M-3)+1;//随机出口从1---(M-3)
end-c=N-
原创力文档

文档评论(0)