?? defbreakerplan.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 <DefBreakerPlan.h>#include <DribblePlan.h>#include <SRPDribblePlan.h>#include <Basics.h>#include <Logger.h>#include <cassert>using namespace std;using namespace Basics;DefBreakerPlan::DefBreakerPlan(const WorldModel *wm, Form &form, const Library &library): Plan("DefBreaker", wm, form, library), srpDribblePlan(new SRPDribblePlan(wm, form, library)), passPlan(new PassPlan(wm, form, library, BPM_BREAKOFFSIDE + BPM_OFFENSE, BPN_ALL, -45, +45, -90, +90)), shootPlan(new ShootPlan(wm, form, library)), xInTwoLastCycle(0), xInLastCycle(0){}DefBreakerPlan::~DefBreakerPlan(){ delete srpDribblePlan; delete shootPlan; delete passPlan;}void DefBreakerPlan::decide(){ LOG << "DefBreakerPlan::decide" << endl; Plan::decide(); bestPlan(3, false, srpDribblePlan, passPlan, shootPlan)->decide(); LOG << "DefenseBreaker Plan WARNING!!! : " << "All WithBall Plans Finished Without Return Any Command." << endl; LOG << "DefenseBreaker Plan : " << "Now Run Dribble Plan Without Check SuccessRate or isFinished" << "(Urgent State)." << endl; DribblePlan dribblePlan(wm, form, library); dribblePlan.decide(); LOG << "DefBreakerPlan Now Kill Program" << endl; assert(0);}double DefBreakerPlan::successRate(){ if (!wm->isBallKickable()) return 0; return bestPlan(3, false, srpDribblePlan, passPlan, shootPlan)->successRate();// +// library.breakExperiment;}bool DefBreakerPlan::isFinished(){ if (!wm->isBallKickable()) return true; if (wm->getBody().getPos().getX() >= xInTwoLastCycle + 1) return false; xInTwoLastCycle = xInLastCycle; xInLastCycle = wm->getBody().getPos().getX();// if (finished == true && wm->getBody().getPos().getX() <// wm->getOppDefenseMedium().x + 3)// form.setBreakExperiment = library.breakExperiment - .002;// else// form.setBreakExperiment = library.breakExperiment + .01; return true;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -