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

📄 behave.cpp

📁 robocup源代码2001年清华机器人源代码
💻 CPP
字号:
/*
    Copyright (C) 2001  Tsinghuaeolus

    Authors : ChenJiang, YaoJinyi, CaiYunpeng, Lishi

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library 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
    Lesser General Public License for more details.

	If you make any changes or have any comments we would appreciate a 
	message to yjy01@mails.tsinghua.edu.cn.
*/

#include "stdafx.h"
#include "Global.h"	
#include "utils.h"

int behave(){
/********* pre_process  *****************/	
	mediator.ResetBuffer();
	situation.JudgeSituation();
	motion.Reset();
	
	DoLog("MyPos (%.2f %.2f) MyVel (%.2f %.2f) Stamina %.f", Self.pos.x, Self.pos.y, Self.global_vel.x, Self.global_vel.y, Self.stamina);
	DoLog("My BodyFacing %.2f HeadFacing %.2f", Self.bodyfacing, Self.headfacing);
	DoLog("Ball Vel (%.2f %.2f) with conf %.4f", ball.global_vel.x, ball.global_vel.y, ball.speed_conf);
	DoLog("Ball RelPos (%.2f %.2f) Pos (%.2f %.2f) with conf %.2f", ball.rel_pos.x, ball.rel_pos.y, ball.pos.x, ball.pos.y, ball.pos_conf);
	DoLog("Offside Line %.2f %d",fieldinfo.GetOffsideLine(), fieldinfo.Behindestopp.ChkData(situation.CurrentTime) );
	if (Self.Is_goalie){
		switch(situation.JudgeGameState()){
		case GS_Before_Kick_Off :
	/* move to right positions and face ball */
			fm.beforekickoff.going();
			break;
		case GS_Their_PlaceKick :
			motion.GoalieDefense();
			break;
		case GS_My_PlaceKick :
			fm.goalieplacekick.going();
			break;
		case GS_Playing :	
			
			motion.Smartgoalie();
			break;
		case GS_Other :
		default :
			break;
		}
		motion.DoVisualDecision();
		mediator.mediation();
		motion.Communication();
	}
	else{
		switch(situation.JudgeGameState()){
		case GS_Before_Kick_Off :
	/* move to right positions and face ball */
			fm.beforekickoff.going();
			break;
		case GS_Their_PlaceKick :
			motion.Defense();
			break;
		case GS_My_PlaceKick :
			fm.placekick.going();
			break;
		case GS_Playing :				
			switch(CP_Number){
			case 1 :
			case 2 :
			case 3 :
			case 4 :
			case 5 :
			case 6 :
			case 7 :
			case 8 :
			case 9 :
			case 10:
			case 11:
				if (!motion.Tryhandle()){
					if(!motion.SmartInterception()){
						motion.Position();
					}
				}
				break;
			default:
				break;
			}
			break;
		case GS_Other :
		default :
			break;
		}
		motion.DoVisualDecision();
		mediator.mediation();
	}
	motion.Communication();
	return 1;
}

⌨️ 快捷键说明

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