📄 stayawayofmark.cpp.svn-base
字号:
#include "StayAwayOfMark.h"SoccerCommand StayAwayOfMark::primaryAction(){ return primarySoc;}void StayAwayOfMark::freeMark(){ if( WM->getAgentStamina().getStamina() > // if stamina high SS->getRecoverDecThr()*SS->getStaminaMax()+800 ) { primarySoc = moveToPos( (WM->getBallPos() + WM->getStrategicPosition())/2, PS->getPlayerWhenToTurnAngle() ); // move to strategic pos cuncurrentSoc = turnNeckToObject( OBJECT_BALL, primarySoc ); } else // else watch ball { primarySoc = turnBodyToObject( OBJECT_BALL ); cuncurrentSoc = turnNeckToObject( OBJECT_BALL, primarySoc ); }}void StayAwayOfMark::freeMarkPos(){ oponnent = WM->getClosestInSetTo( OBJECT_SET_OPPONENTS,WM->getAgentObjectType() ); distRelOpon = WM->getRelativeDistance( oponnent ); distRelBall = WM->getRelativeDistance( OBJECT_BALL ); //cout<<"Free mark"<<endl; if( distRelOpon < distRelBall ) { posRelOpon = WM->getRelativePosition( oponnent ); posRelBall = WM->getRelativePosition( OBJECT_BALL ); aux = posRelBall.operator *(posRelOpon); angulo = (acos(aux.modulo(aux)/(distRelBall*distRelOpon)))*180/3.14159; if( angulo < 30 ) { if( posRelOpon.modulo(posRelOpon) < 10 ) { if(WM->getAgentGlobalPosition().getX() > WM->getGlobalPosition(OBJECT_BALL).getX() + 10) { //cout<<"Desmarcando..."<<endl; aux= WM->getAgentGlobalPosition(); //cout<<"player:"<<endl; //aux.imprime_posicao(aux); aux=(posRelBall.operator *( 0.5 ).operator +((posRelBall.operator *( 0.5 )).normal(posRelBall))).operator -(aux); //cout<<"iniciais"<<endl; //posRelBall.imprime_posicao(posRelBall); //posRelOpon.imprime_posicao(posRelOpon); //cout<<"posicao:"<<endl; //aux.imprime_posicao(aux); primarySoc = moveToPos( aux , PS->getPlayerWhenToTurnAngle() ); cuncurrentSoc = turnNeckToObject(OBJECT_BALL,primarySoc); } } else { if( WM->getAgentStamina().getStamina() > SS->getRecoverDecThr()*SS->getStaminaMax()+800 ) { primarySoc = moveToPos(WM->getStrategicPosition(), PS->getPlayerWhenToTurnAngle()); } } } else { if( WM->getAgentStamina().getStamina() > SS->getRecoverDecThr()*SS->getStaminaMax()+800 ) { primarySoc = moveToPos(WM->getStrategicPosition(), PS->getPlayerWhenToTurnAngle()); } } }}SoccerCommand StayAwayOfMark::cuncurrentAction(){ return cuncurrentSoc;}/* if( WM->getAgentStamina().getStamina() > // if stamina high SS->getRecoverDecThr()*SS->getStaminaMax()+800 ) { soc = moveToPos( WM->getBallPos()/20 + WM->getStrategicPosition(), PS->getPlayerWhenToTurnAngle()); ACT->putCommandInQueue( soc ); // move to strategic pos ACT->putCommandInQueue( turnNeckToObject( OBJECT_BALL, soc ) ); } else // else watch ball { ACT->putCommandInQueue( soc = turnBodyToObject( OBJECT_BALL ) ); ACT->putCommandInQueue( turnNeckToObject( OBJECT_BALL, soc ) ); } agentHadBall = false; */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -