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

📄 pass.h

📁 RoboCup仿真组世界冠军源代码
💻 H
字号:
/*
    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.
*/

#ifndef _pass
#define _pass

#include "bpn.h"
#include "types.h"
#include "Command.h"
#include "Strategy.h"
#include "goingthroughspeed.h"

class Player;

class PassInfo{
private:
	float PS_rapidness;
	AngleDeg PS_angle;
	UNum receiver;

	Vector receive_ball_point;
	float min_receiver_cycles;
	float min_opponent_cycles;
	UNum  most_danger_opponent;
	Vector mostdangeropponentpos;
public:
	PassInfo(UNum receiver = 0, float rapidness = 0.0f, AngleDeg angle = 0.0f, float min_receiver_cycles = 0.0f,
		float min_opponent_cycles = 0, UNum most_danger_opponent = 0, Vector receive_ball_point = 0 ,Vector most_danger_pos = 0){
		this->receiver = receiver;
		this->PS_angle = angle;	
		this->PS_rapidness = rapidness;
		this->min_receiver_cycles = min_receiver_cycles;
		this->min_opponent_cycles = min_opponent_cycles;
		this->most_danger_opponent = most_danger_opponent;
		this->receive_ball_point = receive_ball_point;
		this->mostdangeropponentpos = most_danger_pos;
	}

	UNum Receiver(){ return receiver; }
	Vector ReceiveBallPoint(){ return receive_ball_point;}
	float MinReceiverCycles(){ return min_receiver_cycles;}
	AngleDeg PassAngle(){ return PS_angle; }
	float PassSpeed() { return PS_rapidness; }
	float MinOpponentCycles(){return min_opponent_cycles;}
	Vector MostDangerOpponentPos() {return mostdangeropponentpos;}
	UNum MostDangerOpponent() {return most_danger_opponent;}

	friend class Pass;
	friend class Handleball;
};

class Pass : public GT_speed_utils{
private:
/**************	Explore Pass Routes	*****************************/
/*	pline	*/
	TimedDataTri2DArray<Line, CP_max_considerd_pass_players> pline;
	Line& Pline(int idx1, int idx2);

/*	players been considered	*/
	UNum Players_considered[CP_max_considerd_pass_players];
	int num_players_considered;
	inline Player& GetPlayer_considered(int idx);

/*	routes considered	*/
	Ordered_Soft_Queue<AngleDeg, CP_max_considered_pass_routes> routes_queue;
	AngleDeg Routes_considered[CP_max_considered_pass_routes];
	bool AddRoutes(AngleDeg angle);
	int GetNearestExploredRoute(int routeidx);
	void ResetRoutesBuffer();
	int num_routes_considered;
/*	controllers	*/
	int controllers_of_line[CP_max_considered_pass_routes][CP_max_considerd_pass_players];
	TimedData<int> num_controllers[CP_max_considered_pass_routes];
	float deliminator[CP_max_considered_pass_routes][CP_max_considerd_pass_players];

	float speed_inf[CP_max_considered_pass_routes][CP_max_considerd_pass_players];
	float speed_sup[CP_max_considered_pass_routes][CP_max_considerd_pass_players];
	bool IsExplored(int idx);
	bool AddtoCtrlList(int p, int& begin);
	bool GetGT_speedinfo(int routeidx);
	bool CalcPassinfos(float min_speed, float max_speed, AngleDeg passangle, UNum No);
	DoubleLinked_Soft_List<float, CP_max_considerd_pass_players> ctrl_list;
	Ray ballcourse;
	inline float getdeliminator(Ray& ballcourse, int idx1, int idx2);
/***************	Pass Information	***********************************/
	PassInfo passinfo[CP_max_passinfos];
	int num_passinfo;
	PassInfo potential_passinfo[CP_max_passinfos];
	int num_potential_passinfo;
	float PASSWeightByDistance(float distance);
	
	float get_pass_confidence(PassInfo& inf);
	bool getpassinfo(UNum receiver, AngleDeg PS_angle, float PS_rapidness, PassInfo& inf);
public:
	Pass();
/********	Log passinfos	************************************/
	void LogPass(float angle);
/********	Pass Route Searching	****************************/
	void SetConsideredPlayers();
	void SetConsideredRoutes();
	bool Explore(int routeidx);
/************************************************************/

	BPN PassNet;
	void AddPassInfo(UNum receiver, AngleDeg PS_angle, float PS_rapidness, bool passable);
	void AddPassInfo(const PassInfo& passinfo, bool passable);
	void ResetPassInfo();
	bool Is_Angle_Passable(AngleDeg angle);
	KT_Res pass(PassInfo& passinf);
	KT_Res pass(PassInfo& passinf, Command& command);
/********   Strategy   ******************************/
	bool SmartPass();
	friend class Handleball;
	friend class PlaceKick;
	friend class GoaliePlaceKick;
};

#endif

⌨️ 快捷键说明

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