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

📄 backplan.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 <BackPlan.h>#include <PassPlan.h>#include <DribblePlan.h>#include <ShootToOutPlan.h>#include <InterceptPlan.h>#include <OffensePosPlan.h>#include <Basics.h>#include <Logger.h>#include <cassert>using namespace std;using namespace Basics;BackPlan::BackPlan(const WorldModel *wm, Form &form, const Library &library):		Plan("Back", wm, form, library){}BackPlan::~BackPlan(){}void BackPlan::decide(){	LOG << "BackPlan::decide" << endl;	Plan::decide();	if (wm->isBallKickable())	{		// 1.Dribble With High SuccessRate:		if (isInPlayers(wm->getBody().getUniNum(), "78AB"))			startPlan(new DribblePlan(wm, form, library), .28);		else			startPlan(new DribblePlan(wm, form, library), .33);		// 2.SecureBall Pass To Offense Or Forward_Middle Players:		startPlan(bestPlan(6, true,		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 2, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 3, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 4, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 10, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 11, -180, 180, -180, 180),		new DribblePlan(wm, form, library)),		.24);		// 3.SecureBall Pass To Back_Middle Players:		startPlan(bestPlan(3, true,		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 7, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 8, -180, 180, -180, 180),		new DribblePlan(wm, form, library)),		.25);		// 4.Dribble:		if (isInPlayers(wm->getBody().getUniNum(), "78AB"))			startPlan(new DribblePlan(wm, form, library), .14);		else			startPlan(new DribblePlan(wm, form, library), .23);		// 5.SecureBall Pass To Defense Players:		startPlan(bestPlan(4, true,		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 5, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 6, -180, 180, -180, 180),		new PassPlan(wm, form, library, BPM_SECUREBALL + BPM_OFFENSE, 9, -180, 180, -180, 180),		new DribblePlan(wm, form, library)),		.27);		// 6.Dribble:		if (isInPlayers(wm->getBody().getUniNum(), "78AB"))			startPlan(new DribblePlan(wm, form, library), 0);		else			startPlan(new DribblePlan(wm, form, library), .1);		// 7.Shoot To Out:		startPlan(new ShootToOutPlan(wm, form, library), .3);		LOG << "Back Plan WARNING!!! : "				<< "All WithBall Plans Finished Without Return Any Command." << endl;		LOG << "Back 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 << "BackPlan Now Kill Program" << endl;	assert(0);}double BackPlan::successRate(){	return 1.0;}bool BackPlan::isFinished(){	if(isInPlayers(wm->getBody().getUniNum(), "6789") ||			(isInPlayers(wm->getBody().getUniNum(), "5AB") &&			wm->getBody().getPos().getX() < -20))		return false;	return true;}

⌨️ 快捷键说明

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