本文整理汇总了C++中Agent::Move方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::Move方法的具体用法?C++ Agent::Move怎么用?C++ Agent::Move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::Move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BenchMark
void BenchMark(Agent *agent, int otherturn, int gameCtr) {
string filename = ( otherturn == -1 ? "agent1_stats.dat" : "agent2_stats.dat");
ofstream myFile;
myFile.open( filename.c_str(), ios::out | ios::app );
Game *game = new Game();
Agent *opponent = new Agent(game, otherturn);
Game *hold = agent->ChangeGame(game);
agent->ToggleDebug();
int tie = 0, p1win = 0, p2win = 0;
for(int i = 0; i < 100; i++) {
game->Reset();
while(game->Status()) {
int move;
if(game->curr_player == agent->Turn()) {
move = agent->Move();
} else {
move = opponent->Move();
}
game->Move(move);
}
if(game->Reward() == 1) p1win++;
else if (game->Reward() == -1) p2win++;
else tie++;
}
myFile<<gameCtr<<" "<<p1win<<" "<<p2win<<" "<<tie<<endl;
myFile.close();
agent->ChangeGame(hold);
agent->ToggleDebug();
}
示例2: TestPathEngine
void TestPathEngine()
{
NavMesh* mesh = new NavMesh();
mesh->LoadMesh("nav_test.obj");
mesh->BuildMesh();
mesh->InitCrowd();
float* p = new float[3];
p[0] = 100.0f;
p[1] = 0.0f;
p[2] = 100.0f;
int id = mesh->AddAgent(p);
Agent* agent = new Agent(mesh,id);
float* dest = new float[3];
dest[0] = 10.0f;
dest[1] = 0.0f;
dest[2] = 10.0f;
agent->Move(dest);
for(int i=0;i<100;i++)
{
mesh->UpdateCrowd(0.03);
agent->SyncPosition();
}
}