plan.h
来自「巫魔问题求解」· C头文件 代码 · 共 76 行
H
76 行
#pragma once
#include <vector>
namespace _base
{
class Cell;
}
namespace _algorithm
{
class WorldModel;
class Effector;
class Thinker;
class Plan
{
public:
//type TPath
typedef std::vector<_base::Cell*> TPath;
//operations
enum eOperations
{
O_TurnLeft,
O_TurnRight,
O_GoAhead,
O_Escape,
O_Shoot,
};
public:
//constructor and destructor
Plan(WorldModel &wm, Effector &eff);
~Plan(void);
private:
//disable copy constructor
Plan(const Plan &from);
public:
//step
void Step(void);
protected:
//get informations from the clientmap from worldmodel, and generate the target place
_base::Cell* GenTargetPlace(void);
//generate a path according to from and to,
//from and to are ids from TheClientMap().TheSafeCells()
TPath GenPath(int from, int to);
//generate a new task, currently just support one operation per step
void GenTasks(void);
//execute an operation
void ExeDecision(void);
//unused, for generation escape operations
void GenEscape(void);
//unused, to judge if there is new information being needed
bool IsNeedNewInfo(void);
public:
//references
WorldModel &TheWorldModel(void);
const WorldModel &GetWorldModel(void) const;
Effector &TheEffector(void);
const Effector &GetEffector(void) const;
Thinker &TheThinker(void);
const Thinker &GetThinker(void) const;
protected:
//generate paths, and get the head of the paths to generate tasks, then execute
std::vector<TPath> mPaths;
std::vector<eOperations> mTasks;
WorldModel *mpWorldModel;
Effector *mpEffector;
Thinker *mpThinker;
};
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?