📄 df_positioning.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 _df_positioning
#define _df_positioning
#include "bpn.h"
#include "types.h"
#include "Command.h"
#include "Strategy.h"
#define DF_FORMATION_DEFENDEE -11
#define MAX_DF_ARRANGEMENTS 100
enum DF_Type{DF_Mark, DF_Block, DF_Formation, DF_Press};
class DF_Arrangement{
Vector df_size; // defense area size
float calc_deviation(float dist);
bool getblockpoint(Vector opp_IT_pos, Vector selfpos, float opp_IT_cycles, float myspeed, float oppspeed, Vector& blockpos);
bool getsubpoint(Vector opttarget, Vector opponent_pos, Vector selfpos, float ratio_speed, float predis, Vector& blockpos);
bool getmarkposition(UNum My, UNum Opp, Vector ballpos, Vector& markpos);
bool getblockposition(UNum My, UNum Opp, Vector &blockpos);
bool getpressposition(UNum My, UNum Opp, Vector &presspos);
void setpriority();
float getblockpriority();
float getformationpriority();
float getpresspriority();
void setdfinfo();
Vector fm_pos;
float presspriority;
float blockpriority;
float markpriority;
float formationpriority;
public:
float getmarkpriority();
DF_Arrangement(UNum defender = -1, UNum defendee = -1);
DF_Type df_type;
bool valid;
UNum defendee;
UNum defender;
Vector df_point;
float deviation_dist;
float pos_dist;
float threat;
float priority;
bool Arrange_DF_for(UNum defender, UNum defendee = DF_FORMATION_DEFENDEE);
bool Arrange_DF_Formation_for(UNum defender);
bool Arrange_DF_Block_for(UNum defender, UNum defendee);
bool Arrange_DF_Mark_for(UNum defender, UNum defendee);
bool Arrange_DF_Press_for(UNum defender, UNum defendee);
bool operator == (const DF_Arrangement& rhs);
bool operator > (const DF_Arrangement& rhs);
bool operator >= (const DF_Arrangement& rhs);
bool operator < (const DF_Arrangement& rhs);
bool operator <= (const DF_Arrangement& rhs);
bool IsMutex(const DF_Arrangement& arrangement);
float QueryPriority(bool block_applied);
};
class DF_positioning{
private:
DF_Arrangement arrangements[MAX_DF_ARRANGEMENTS];
int Order_of_arrangements[MAX_DF_ARRANGEMENTS];
int num_arrangements;
void Searchfor_Scheme(float priority_sum);
void SortArrangements();
//For the algorithm to schedule the arrangements
int scheme_members[SP_team_size];
int num_scheme_members;
int mutexs[MAX_DF_ARRANGEMENTS][2 * SP_team_size];
int num_mutexs[MAX_DF_ARRANGEMENTS];
int max_nonmutexs;
float max_priority_sum;
int optimal_scheme[SP_team_size];
int block_applied_count;
public:
DF_positioning();
BPN Mark_Net;
BPN Block_Net;
BPN FM_Priority_Net;
BPN Press_Net;
The3rdCurve sens_pos_factor;
void AddDF_Arrangement(const DF_Arrangement& arrangement);
DF_Arrangement& Arrangement(int idx);
void ResetBuffer();
bool Do_arranging();
bool MakeDefenseDecision();
DF_Arrangement& GetAssignment();
float Getmarkpriority(double threat, double deviation, double dist); //yjy, to be used from outside
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -