91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

迷宮的生成與自動尋路; 詳細的介紹了迷宮的生成,還有求解。 代碼有注釋
好好學習天天向上
希望大家珍惜大學時光

資源截圖

代碼片段和文件信息

#include
#include
#include?
#include?
#include?
#include?
#include?
#include?
using?namespace?std;

#define?Status?int
#define?Wall?1
#define?Road?0
#define?Start?0
#define?End?0
#define?Esc?5
#define?Up?1
#define?Down?2
#define?Left?3
#define?Right?4
#define?ERROR?0
#define?OVERFLOW?-2
#define?TRUE?1
#define?FALSE?0
#define?OUT?8
#define?STEPPED?2
#define?MAX?1000000
////////////////////////////////////////////////////////////////
/**************************************************************/
////////////////////////////////////////////////////////////////
//以下為函數申明,各種結構體的定義
//??建立節點結構體??
struct?Point
{
int?row;
int?col;

Point(int?x?int?y)?{
this->row?=?x;
this->col?=?y;
}

bool?operator!=(const?Point&?rhs)?{
if?(this->row?!=?rhs.row?||?this->col?!=?rhs.col)???????//判斷出入口是否符合迷宮大小??
return?true;
return?false;
}
};
//??????定義當前點和起點的結構體
typedef?struct
{
int?x?y;
int?parent_x?parent_y;
}QNode?*QueuePtr;
typedef?QNode?ElemType;
typedef?struct?SqQueue
{
ElemType?*?base;
int?front;
int?rear;
}SqQueue;//隊列結構體
typedef?struct
{
int?top?base?count;
ElemType?container[19000];
}SqStack;
Status?InitStack(SqStack?*s);
Status?StackEmpty(SqStack?s);
Status?InitQueue(SqQueue?*Q);//初始化隊列??????????
Status?QueueEmpty(SqQueue?Q);//判斷隊列是否為空????
Status?GetHead(SqQueue?Q?ElemType?*e);//取隊列頭元素??
Status?EnQueue(SqQueue?*Q?ElemType?e);//入隊???????
Status?DeQueue(SqQueue?*Q?ElemType?*e);//出隊?????
Status?Push(SqStack?*s?ElemType?e);//棧???????
Status?Pop(SqStack?*s?ElemType?*e);//棧???????
void?game2(int?**Map?int?Height?int?Width);//廣度優先搜索走迷宮過的操作???
void?gotoxy(int?x?int?y); //移動光標的函數??
void?paint(int?**Map?int?x?int?y); //打印迷宮墻和路的函數??
void?paint2(int?**Map?int?x?int?y); //打印迷宮路徑的函數??
int?**?createMap(int?Width?int?Height); //創建二維數組?用于儲存迷宮?
void?create1(int?**?MAP?int?x?int?y?int?Height?int?Width?int?speed); //隨機生成迷宮函數?
void?create2(int?**?MAP?int?x?int?y?int?Height?int?Width); //隨機生成迷宮函數?
int?get_key(); //接受方向鍵的函數?
void?game(int?**Map?int?Height?int?Width); //游戲操作函數?????
void?hidden(); //隱藏光標的函數???
void?print(int?x?int?y); //打印路徑函數?????
void?printM(); //打印菜單函數?????
Point?getAdjacentNotVisitedNode(bool**?mark?Point?point?int?m?int?n);//獲取相鄰未被訪問的節點的函數???
void?mazePath(void*?maze?int?m?int?n?const?Point&?startP?Point?endP?stack&?pointStack);//給定二維迷宮,求可行路徑的函數(DFS)?

???////////////////////////////////////////////////////////////////
???/**************************************************************/
???////////////////////////////////////////////////////////////////
???//以下為主函數
int?main()
{
int?choose?=?0;
srand((unsigned)time(NULL));
while?(1)
{

評論

共有 條評論