📄 simplestrange.h
字号:
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the SIMPLESTRANGE_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// SIMPLESTRANGE_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#pragma once
#include "const.h"
#ifdef SIMPLESTRANGE_EXPORTS
#define SIMPLESTRANGE_API __declspec(dllexport)
#else
#define SIMPLESTRANGE_API __declspec(dllimport)
#endif
struct Vector3D
{
double x, y, z;
Vector3D()
{
}
Vector3D(double dbx,double dby,double dbz):x(dbx),y(dby),z(dbz)
{
}
};
typedef struct
{
long left, right, top, bottom;
} Bounds;
typedef struct
{
Vector3D pos;
double rotation;
double velocityLeft, velocityRight;
} Robot;
typedef struct
{
Vector3D pos;
double rotation;
} OpponentRobot;
typedef struct
{
Vector3D pos;
} Ball;
typedef struct
{
Robot home[PLAYERS_PER_SIDE];
OpponentRobot opponent[PLAYERS_PER_SIDE];
Ball currentBall, lastBall, predictedBall;
Bounds fieldBounds, goalBounds;
long gameState;
long whosBall;
void *userData;
} Environment;
//************************************************************************************
//*****以下为自定义扩展结构体,大家可以在此基础上进行扩展,添加自己需要的数据*********
//************************************************************************************
/////// 相对位置 或者速度 z为相对角度,v 为位移
typedef struct
{
double x, y, z;
union{
double v; //速度
double dis; //距离
};
} FromTo,Speed;
////我方单个队员的资料
typedef struct
{
Vector3D InitPos; //初始位置
Vector3D pos;
double rotation;
double velocityLeft, velocityRight;
Vector3D oldpos; //记录 我方 队员的旧坐标,方向
Vector3D oldvelocity; //纪录 我方 队员上次驱动力
Speed speed; //纪录 我方 队员的速度,跑位的方向
FromTo ToBall; //人和球的相对位置
FromTo NextToBall; //人和球的相对位置
Vector3D BestBall; //人和球的相对位置
bool deel; // 是否某个队员的处理已经搞定,避免重复给一个人施加动作
int pre_steps; //要想碰到球,需要的步数!!!!
Vector3D ball; //人和球的相对位置
} MyRobot;
////对方单个队员的资料
typedef struct
{
Vector3D pos;
double rotation;
Vector3D oldpos; //记录 对方 队员的旧坐标,方向
Vector3D InitPos; //初始位置
Speed speed; //纪录 对方 队员的速度,跑位的方向
FromTo ToBall; //对方 队员和球的相对位置
} MyOpponent;
//// 足球
typedef struct
{
Vector3D oldpos; //上一次球的位置
Vector3D pos; //现在球的位置
Vector3D prepos; //数周期之后球的位置
Speed speed; //速度
FromTo ToGate; //球和对方球门的相对位置
double gate_angle; //和门柱的夹角,很有用可以判断球是否好进啊
FromTo GateTo; //球和我方球门的相对位置
} MyBall;
typedef struct
{
MyRobot robot[5]; // 我方 队员
MyOpponent opp[5]; // 对方 队员
MyBall ball; // 球子
bool judged; // 已经 判断了场地吗??它的值只改变一次
bool is_yellow; //是 黄队 ??
long gameState; //0,1,2,3,4,5
long whosBall; //0,1,2
long penalty_count; //点球的计时
}MyEnv;
//********************************************************************
/* MUST BE IMPLEMENTED */
extern "C" SIMPLESTRANGE_API void Create ( Environment *env ); // implement this function to allocate user data and assign to Environment->userData
extern "C" SIMPLESTRANGE_API void Strategy ( Environment *env );
extern "C" SIMPLESTRANGE_API void Destroy ( Environment *env ); // implement this function to free user data created in Create (Environment*)
void Pre (Environment *env);
void End (Environment *env);
void Play(MyEnv* g);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -