迷宫问题中的地图属性部分

#define MAZE_LENGTH 8
#define MAZE_WIDTH 8
#define NORTH 3
#define SOUTH 1
#define WEST 4
#define EAST 2
#define START 3
#define END 4
class CreatMap{
public:
 CreatMap();
 int get_point_map(int ,int ) const;
 int get_point_history(int ,int) const;
 void write_point_history(int ,int);
 int get_point_direction(int ,int) const;
 void write_point_direction(int ,int ,int);

private:
 static int map_point[MAZE_LENGTH][MAZE_WIDTH];
 static int map_history[MAZE_LENGTH][MAZE_WIDTH];
 static int map_direction[MAZE_LENGTH][MAZE_WIDTH];
};

int CreatMap::map_point[MAZE_LENGTH][MAZE_WIDTH]=
    {{START,0,1,0,0,0,1,0},{0,0,1,0,0,0,1,0},{0,0,0,0,1,1,0,0},{0,1,1,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,1,0,0,0,1,0,0},{0,1,1,1,0,1,1,0},{1,0,0,0,0,0,0,END}};
int CreatMap::map_history[MAZE_LENGTH][MAZE_WIDTH]={0};
int CreatMap::map_direction[MAZE_LENGTH][MAZE_WIDTH]={0};

CreatMap::CreatMap()
{
}

int CreatMap::get_point_map(int x,int y) const
{
 return map_point[x][y];
}

int CreatMap::get_point_history(int x, int y) const
{
 return map_history[x][y];
}

void CreatMap::write_point_history(int x, int y)
{
 map_history[x][y]=1;
}

int CreatMap::get_point_direction(int x, int y) const
{
 return map_direction[x][y];
}

void CreatMap::write_point_direction(int x, int y, int direction)
{
 if(direction!=NORTH||direction!=SOUTH||direction!=WEST||direction!=EAST) exit(1);
 map_direction[x][y]=direction;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值