www.pudn.com > StrategyClass1.rar > Strategy.h, change:2007-04-23,size:2912b

#ifndef Strategy_H 
#define Strategy_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 STRATEGY_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  
// STRATEGY_API functions as being imported from a DLL, wheras this DLL sees symbols 
// defined with this macro as being exported. 
#define STRATEGY_API __declspec(dllexport) 
#define STRATEGY_API __declspec(dllimport) 
#include <string.h> 
#include <stdio.h> 
const long PLAYERS_PER_SIDE = 5; 
// gameState 球的状态 
const long FREE_BALL = 1;       //当是自由球 
const long PLACE_KICK = 2;      //点球 
const long PENALTY_KICK = 3;    //罚球 
const long FREE_KICK = 4;       //任意球 
const long GOAL_KICK = 5;       //门球 
// whosBall  持球者 
const long ANYONES_BALL = 0; 
const long BLUE_BALL = 1; 
const long YELLOW_BALL = 2; 
// global variables -- Useful field positions ... maybe??? 
const double FTOP = 77.2392; 
const double FBOT = 6.3730; 
const double GTOPY = 49.6801; 
const double GBOTY = 33.9320; 
const double GRIGHT = 97.3632; 
const double GLEFT = 2.8748; 
const double FRIGHTX = 93.4259; 
const double FLEFTX = 6.8118; 
const double PI = 3.1415926; 
typedef struct 
	double x, y, z; 
} Vector3D; 
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; 
typedef void (*MyStrategyProc)(Environment*); 
extern "C" STRATEGY_API void Create ( Environment *env ); // implement this function to allocate user data and assign to Environment->userData 
extern "C" STRATEGY_API void Strategy ( Environment *env ); 
extern "C" STRATEGY_API void Destroy ( Environment *env ); // implement this function to free user data created in  Create (Environment*) 
#endif // Strategy_H