maze.cpp

来自「利用人工智能的经典算法实现迷宫游戏;里面的A星(a*)算法可以很方便的移植到应用」· C++ 代码 · 共 55 行

CPP
55
字号
// maze.cpp: implementation of the maze class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "qiyuan.h"
#include "maze.h"
#include <stdio.h>
#include <stdlib.h>
#include "list_node1.h"
#include "m_list.h"
#include "MyCounter.h"
#include "UserSet.h"


#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
int step;
extern	int Astep;
//step=0;

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

maze::maze()
{
//初始化迷宫行15列15
	row=12;
	col=15;
	StartPos.x=1;
	StartPos.y=CarPos.y=0;
	GoalPos.x=11;
	GoalPos.y=15;
//	Astep=0;
//将迷宫初始化为全1,即全墙!!!int index1=0,index2=0;
	int index1=0,index2=0;
	for  (index1=0;index1<MOSTNUM;index1++)
		{
			for(index2=0;index2<MOSTNUM;index2++)
			{
				MazeMap[index1][index2]=1;
			};
		};	
//	step=0;
}

maze::~maze()
{

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?