⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 waitplan.cpp

📁 2006年世界杯足球赛2D仿真组第16名的源代码。在此代码上随便改改
💻 CPP
字号:
/* *  Copyright 2002-2005, Mersad Team, Allameh Helli High School (NODET). * *  This program is free software, you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *  GNU Library General Public License for more details. * *  This file is created by: Sassan Haradji * *  Released on Monday 1 August 2005, 10 Mordad 1384 by Mersad RoboCup Team. *  For more information please read README file.*/#include <AdvancedAgent.h>#include <WaitPlan.h>#include <DribblePlan.h>#include <PassPlan.h>#include <InterceptPlan.h>#include <OffensePosPlan.h>#include <Logger.h>#include <Basics.h>#include <cassert>using namespace std;using namespace Basics;WaitPlan::WaitPlan(const WorldModel *wm, Form &form, const Library &library,		Side side): Plan("Wait", wm, form, library), side(side),		minSuccessRate(.24 + reRate(wm->getBody().getPos().getX(), 10, 40, 0, .03)){	switch (wm->getBody().getUniNum())	{	case 2:		fPlayer = 10;		bPlayer = 7;		break;	case 10:		fPlayer = 2;		bPlayer = 7;		break;	case 7:		fPlayer = 2;		bPlayer = 10;		break;	case 4:		fPlayer = 11;		bPlayer = 8;		break;	case 11:		fPlayer = 4;		bPlayer = 8;		break;	case 8:		fPlayer = 4;		bPlayer = 11;		break;	default:		fPlayer = BPN_ALL;		bPlayer = BPN_ALL;	}}WaitPlan::~WaitPlan(){}void WaitPlan::decide(){	if (side == SI_LEFT)		LOG << "WaitPlan::decide (Side : Left)" << endl;	else		LOG << "WaitPlan::decide (Side : Right)" << endl;	Plan::decide();	if (wm->isBallKickable())	{		startPlan(bestPlan(2, true,				new PassPlan(wm, form, library, BPM_SECUREBALL,						fPlayer, -180, 180, -180, 180),				new PassPlan(wm, form, library, BPM_SECUREBALL,						bPlayer, -180, 180, -180, 180)), minSuccessRate);		LOG << name << " Plan WARNING!!! : "				<< "All WithBall Plans Finished Without Return Any Command." << endl;		LOG << name << " Plan : "				<< "Now Run Dribble Plan Without Check SuccessRate or isFinished"				<< "(Urgent State)." << endl;		DribblePlan dribblePlan(wm, form, library);		dribblePlan.decide();	}	else	{		if (library.gwSelection == WOBS_INTERCEPT)			startPlan(new InterceptPlan(wm, form, library));		startPlan(new OffensePosPlan(wm, form, library));	}		LOG << "WaitPlan Now Kill Program" << endl;	assert(0);}double WaitPlan::successRate(){	return 1.0;}bool WaitPlan::isFinished(){	if (!wm->isBallKickable()) return false;	Plan *tempPlan = bestPlan(2, true,			new PassPlan(wm, form, library, BPM_SECUREBALL,					fPlayer, -180, 180, -180, 180),			new PassPlan(wm, form, library, BPM_SECUREBALL,					bPlayer, -180, 180, -180, 180));	bool finished = true;	if (tempPlan->successRate() >= minSuccessRate)		finished = false;	delete tempPlan;	return finished;}

⌨️ 快捷键说明

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