state.cpp

来自「迷宫智能A*搜索的算法实现」· C++ 代码 · 共 55 行

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

#include "stdafx.h"
#include "迷宫.h"
#include "State.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

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

CState::CState()
{
	R=-1;
	C=-1;
	D=-1;
	father=0;
	cost=0;
}

CState::~CState()
{

}
CState::CState(int r,int c, int d,int co,CState* f)
{
	R=r;
	C=c;
	D=d;
	father=f;
	cost=co;
}

bool CState::operator ==(CState x)
{
	return (R==x.R)&&(C==x.C)&&(D==x.D);
}

CState CState::operator =(CState x)
{
	 C=x.C;
	 R=x.R;
	 D=x.D;
	 cost=x.cost;
	 father=x.father;
	 visited=x.visited;
	 return *this;
}

⌨️ 快捷键说明

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