首页 > 其他 > 详细

迷宫问题

时间:2015-12-27 15:54:45      阅读:245      评论:0      收藏:0      [点我收藏+]

源码 : github.com/drdeng/maze

//////////////////////////////////////////////
// Deng Yong and HanMo Cheng
// date:2015 12 14
//////////////////////////////////////////////////
#ifndef STACK_H
#define STACK_H

//定义坐标
typedef struct coordinate
{
int row;//行
int column;//列
int direction;//方向
}coordinate;
//移动方向


//Move move[4]={{0,1},{1,0},{0,-1},{-1,0}};
//结构体链表
typedef struct LinkNode
{
coordinate data;
//LinkNode *next;
struct LinkNode *next;//
}
LinkNode , *Node;

class stack
{

private:
LinkNode *top;
public:
stack()
{
//top=NULL;
top=nullptr;//c++ 11 using nullptr not NULL
}
// bool initialStack(LinkNode * &top);//初始化栈
void pushStack(coordinate x);//入栈
void Clear();//清空栈
coordinate GetPop(/*LinkNode *&top, coordinate &data*/);
coordinate Pop();
bool Empty();


private:

};

#endif

 

//maze.h

#ifndef MAZE_H
#define MAZE_H
#include <iostream>
#include "stack.h"
#include <map>
#include<string>
using namespace std;

class stack;

class maze {

public:
maze()=default;
bool find( );//寻找迷宫解
int ** InPut_maze();//生成迷宫
int **get_maze();//读取迷宫数据
void before_direct_readmaze();//在直接调用这个函数之前
// void OutPut_maze(stack p);//输出迷宫的解
void PrintPath(stack p);//以坐标形式输出迷宫
void PrintPath2(stack p);


private:
int M_Row;//
int M_Column;
int **M_maze;//迷宫二维数组
struct Move
{
int row;
int column;
};
Move move[4]={{0,1},{1,0},{0,-1},{-1,0}};


}
;
#endif

 

迷宫问题

原文:http://www.cnblogs.com/caffe/p/5080073.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!