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

📄 forwardplan.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 <BasicDash.h>#include <AdvancedAgent.h>#include <ForwardPlan.h>#include <DefBreakerPlan.h>#include <MoveToForwardPlan.h>#include <WaitPlan.h>#include <GotoSidePlan.h>#include <DribblePlan.h>#include <Logger.h>#include <Basics.h>#include <cassert>using namespace std;using namespace Basics;ForwardPlan::ForwardPlan(const WorldModel *wm, Form &form,		const Library &library): Plan("Forward", wm, form, library){}ForwardPlan::~ForwardPlan(){}void ForwardPlan::decide(){	LOG << "ForwardPlan::decide" << endl;	string hearString = wm->getHearedPlanInfo();	if (hearString == "XGSPL" && library.gwSelection == WOBS_INTERCEPT) 		if (isInPlayers(wm->getBody().getUniNum(), "5234B"))			startPlan(new GotoSidePlan(wm, form, library, SI_LEFT));	if (hearString == "XGSPR" && library.gwSelection == WOBS_INTERCEPT) 		if (isInPlayers(wm->getBody().getUniNum(), "5234A"))			startPlan(new GotoSidePlan(wm, form, library, SI_RIGHT));/*	if (!subPlans.empty())		if (subPlans.top()->getName() != "DefBreaker" && wm->isBallKickable())			if (isInPlayers(wm->getBody().getUniNum(), "AB"))				startPlan(new DefBreakerPlan(wm, form, library), .32);			else if (isInPlayers(wm->getBody().getUniNum(), "234"))				startPlan(new DefBreakerPlan(wm, form, library), .34);			else if (isInPlayers(wm->getBody().getUniNum(), "78"))				startPlan(new DefBreakerPlan(wm, form, library), .4);*/	Plan::decide();	startPlan(new MoveToForwardPlan(wm, form, library, 3.5));	int uniNum = wm->getBody().getUniNum();	if (isInPlayers(uniNum, "35"))		uniNum = (wm->getBody().getPos().getY() > 0)?4:2;	switch (uniNum)	{	case 2:	case 10:		startPlan(new WaitPlan(wm, form, library, SI_LEFT));		startPlan(new GotoSidePlan(wm, form, library, SI_RIGHT));		break;			case 4:  case 11:		startPlan(new WaitPlan(wm, form, library, SI_RIGHT));		startPlan(new GotoSidePlan(wm, form, library, SI_LEFT));		break;	}	startPlan(new MoveToForwardPlan(wm, form, library, 2.2));	startPlan(bestPlan(2, true,			new PassPlan(wm, form, library, BPM_ALL, BPN_ALL,					-180, 180, -180, 180),			new DribblePlan(wm, form, library)));	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();		LOG << "ForwardPlan Now Kill Program" << endl;	assert(0);}double ForwardPlan::successRate(){	return 1.0;}bool ForwardPlan::isFinished(){	if(isInPlayers(wm->getBody().getUniNum(), "234") ||			(isInPlayers(wm->getBody().getUniNum(), "5AB") &&			wm->getBody().getPos().getX() >= -20))		return false;	return true;}

⌨️ 快捷键说明

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