www.pudn.com > StrategyClass1.rar > StrategySystem.cpp, change:2007-04-23,size:24342b


// StrategySystem.cpp: implementation of the CStrategySystem class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "Strategy.h" 
#include "StrategySystem.h" 
#include <math.h> 
 
//球的半径 
#define BR   0.5 
//机器人半径          
#define RR   1.0 
#define Pi   3.1415926 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
CStrategySystem::CStrategySystem(Environment& env) 
{ 
	GetEnvironment(env);		//初始化成员 
} 
 
CStrategySystem::~CStrategySystem() 
{ 
	 
} 
 
/*************************** 
函数名:Run 
功  能:策略的执行部分 
输  入: 
返  回: 
备  注:无 
***************************/ 
void CStrategySystem::Run(Environment& env)			//策略的执行部分 
{ 
	GetEnvironment(env);				//初始化环境变量(不要修改) 
	 
	/************************************************************** 
	**************************	策略部分 *************************** 
	***************************************************************/ 
	 
	switch (m_GameState) 
	{ 
	case 0: 
		Role(); 
/*		MyAttack(m_Home[4]); 
		MyAttack(m_Home[3]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
*/ 
		break; 
		 
	case FREE_BALL: 
		 
		break; 
		 
	case PLACE_KICK: 
		 
		break;			 
	case PENALTY_KICK: 
		switch (m_WhosBall) 
		{ 
		case ANYONES_BALL: 
			break; 
		case BLUE_BALL: 
			break; 
		case YELLOW_BALL: 
			break; 
		} 
		break; 
		 
		case FREE_KICK: 
			 
			break; 
			 
		case GOAL_KICK: 
			break; 
	} 
	SetMyStrategy();		//速度设置函数(不要修改) 
} 
 
/*************************** 
函数名:GetEnvironment 
功  能:获得环境变量的一些值 
输  入: 
返  回: 
备  注:无 
***************************/ 
void CStrategySystem::GetEnvironment(Environment& env) 
{ 
	//初始化环境信息 
	m_pEnv = &env; 
	m_CurrentBall = env.currentBall; 
	m_FieldBounds = env.fieldBounds; 
	m_GameState = env.gameState; 
	m_GoalBounds = env.goalBounds; 
	m_LastBall = env.lastBall; 
	m_PredictedBall = env.predictedBall; 
	m_pUserData = env.userData; 
	m_WhosBall = env.whosBall; 
	 
	for (int nI = 0; nI < PLAYERS_PER_SIDE; nI ++ ) 
	{ 
		m_Home[nI] = env.home[nI]; 
		m_Opponent[nI] = env.opponent[nI]; 
	} 
} 
 
//初始化 
CStrategySystem::CStrategySystem():m_pEnv(NULL) 
{ 
	 
} 
 
CEnvironment& CEnvironment::operator =(const Environment &env) 
{ 
	currentBall = env.currentBall; 
	fieldBounds = env.fieldBounds; 
	gameState = env.gameState; 
	goalBounds = env.goalBounds; 
	lastBall = env.lastBall; 
	predictedBall = env.predictedBall; 
	userData = env.userData; 
	 
	for (int nI = 0; nI < PLAYERS_PER_SIDE; nI ++ ) 
	{ 
		home[nI] = env.home[nI]; 
		opponent[nI] = env.opponent[nI]; 
	} 
	 
	return *this; 
} 
 
CBall& CBall::operator =(const Ball &ball) 
{ 
	pos = ball.pos; 
	return *this; 
} 
 
CBounds& CBounds::operator =(const Bounds &bounds) 
{ 
	bottom = bounds.bottom; 
	left = bounds.left; 
	right = bounds.right; 
	top = bounds.top; 
	return *this; 
} 
 
CVector3D& CVector3D::operator =(const Vector3D &vec3D) 
{ 
	x = vec3D.x; 
	y = vec3D.y; 
	z = vec3D.z; 
	return *this; 
} 
 
COpponentRobot& COpponentRobot::operator =(const OpponentRobot &oppRobot) 
{ 
	pos = oppRobot.pos; 
	rotation = oppRobot.rotation; 
	return *this; 
} 
 
CRobot& CRobot::operator =(const Robot &robot) 
{ 
	pos = robot.pos; 
	rotation = robot.rotation; 
	velocityLeft = robot.velocityLeft; 
	velocityRight = robot.velocityRight; 
	return *this; 
} 
 
 
 
void CStrategySystem::SetMyStrategy() 
{ 
	for ( int nI = 0; nI < PLAYERS_PER_SIDE; nI ++ ) 
	{ 
		m_pEnv->home[nI].velocityLeft = m_Home[nI].velocityLeft; 
		m_pEnv->home[nI].velocityRight = m_Home[nI].velocityRight; 
	} 
	 
	m_pEnv = NULL;			//释放指针 
} 
 
void CRobot::Position( const CVector3D &pos) 
{ 
	Position(pos.x,pos.y); 
} 
 
/*************************************************************************** 
以上部份尽量不修改 
***************************************************************************/ 
 
 
/************************************************************************************* 
进攻部份 
**************************************************************************************/ 
/*************************** 
函数名:MyAttack 
功  能:跟据实际的坐标,实行相应的策略 
输  入:机器人标号 
返  回:无 
备  注:无 
***************************/ 
void CStrategySystem::MyAttack(CRobot& robot) 
{ 
	//	PredictBall(m_pEnv); 
	int nstyle = MyMoveStyle(m_CurrentBall.pos,robot.pos ); 
	CVector3D ptwant = m_PredictedBall.pos; 
	 
	switch(nstyle)  
	{ 
	case 0: 
		break; 
	case 1: 
		break; 
	case 2: 
		ptwant.x += 2*RR; 
		this->MyShoot(robot); 
		break; 
	case 3: 
		ptwant.x += 2*RR; 
		this->MyShoot(robot); 
		break; 
	case 4:                      
		ptwant.y += 2*RR; 
		this->MyShoot(robot); 
		break; 
	case 5: 
		ptwant.y -= 2*RR; 
		this->MyShoot(robot); 
		break; 
	default: 
		break; 
	} 
	 
	robot.Position(ptwant.x,ptwant.y); 
} 
 
/*************************** 
函数名:PredictBall 
功  能:预测球的位置 
输  入:无 
返  回:无 
备  注:无 
***************************/ 
void CStrategySystem::PredictBall() 
{ 
	double dx = m_CurrentBall.pos.x - m_LastBall.pos.x; 
	double dy = m_CurrentBall.pos.y - m_LastBall.pos.y; 
	m_PredictedBall.pos.x = m_CurrentBall.pos.x + dx; 
	m_PredictedBall.pos.y = m_CurrentBall.pos.y + dy; 
} 
 
/*************************** 
函数名:MyMoveStyle 
功  能:当球和机器人到达一定的区域时,返回执行相应的策略标号 
输  入:机器人坐标,足球的坐标 
返  回:策略编号 
备  注:无 
***************************/ 
int CStrategySystem::MyMoveStyle(CVector3D BPoint, CVector3D RPoint) 
{ 
	double arg; 
	if ((BPoint.x+BR)<(RPoint.x-3*RR))   //当是一部份进攻区域时 
	{ 
		return 1; 
	} 
	 
	if ((RPoint.x-3*RR)<(BPoint.x) && (BPoint.x<(RPoint.x-RR))) 
	{ 
		arg = atan2(BPoint.y-RPoint.y,RPoint.x - BPoint.x)/Pi*180; 
		if (arg < 45 && arg > -45 ) 
		{ 
			return 1; 
		} 
		else 
		{ 
			if (BPoint.y > RPoint.y) 
			{ 
				return 2; 
			} 
			else 
			{ 
				return 3; 
			} 
		} 
	} 
	 
	if(BPoint.x>(RPoint.x+RR) && (BPoint.y < ( RPoint.y + RR + BR ) && BPoint.y > RPoint.y )) 
	{ 
		return 4; 
	} 
	 
	if(BPoint.x>(RPoint.x+RR) && (BPoint.y < RPoint.y && BPoint.y > ( RPoint.y - RR - BR ) )) 
	{ 
		return 5; 
	} 
	 
	if ( RPoint.y > BPoint.y ) 
	{ 
		return 2; 
	} 
	else 
	{ 
		return 3; 
	} 
	return 0; 
} 
 
/*************************** 
函数名:MyShoot 
功  能:进行射门 
输  入:机器人标号 
返  回:无 
备  注:无 
***************************/ 
void CStrategySystem::MyShoot(CRobot& robot) 
{ 
	double dbAngle; 
	double dbX, dbY; 
	 
	dbX = m_pEnv->currentBall.pos.x-6.8118; 
	dbY = m_pEnv->currentBall.pos.y-33.9320; 
	 
	if ( m_pEnv->currentBall.pos.x-33.9320 ) 
	{ 
		 
	} 
} 
 
/*************************** 
函数名:MoonFollowOpponent 
功  能:进行跟踪对方球员 
输  入:对方机器人标号 
返  回:无 
备  注:无 
***************************/ 
void CRobot::MoonFollowOpponent(COpponentRobot& opponent) 
{ 
	this->Position(opponent.pos); 
} 
 
/******************************************************************************* 
防守策略 
*******************************************************************************/ 
/*************************** 
函数名:MyDefender 
功  能:防守策略 
输  入:机器人标号 
返  回:无 
备  注:无 
***************************/ 
void CStrategySystem::MyDefender(CRobot& robot) 
{ 
    Vector3D point; 
 
	if ( (m_pEnv->currentBall.pos.x + BR) < 80.4374 && (m_pEnv->currentBall.pos.x + BR) > 70.1202 ) 
	{	 
		if ( (robot.pos.y - point.y) < RR && (robot.pos.y - point.y) > (-RR) && robot.pos.x > 70.1202 )    
		{ 
			robot.Position( point.x, point.y ); 
		} 
		else 
		{ 
			robot.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y ); 
		} 
	} 
	if ( (m_pEnv->currentBall.pos.x + BR) >= 80.4374 && ( m_pEnv->currentBall.pos.x ) <= 91.7692-RR ) 
	{ 
		if ( (robot.pos.y - point.y) < RR && (robot.pos.y - point.y) > (-RR) ) 
		{ 
			if ( m_pEnv->currentBall.pos.y > 27.8966 && m_pEnv->currentBall.pos.y < 58.5660 ) 
			{ 
				if ( m_pEnv->currentBall.pos.y > 27.8966 && m_pEnv->currentBall.pos.y < 33.7197 ) 
				{ 
					if ( robot.pos.y - RR - BR > m_pEnv->currentBall.pos.y ) 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
					} 
					else 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x, 16.2128 ); 
					} 
				} 
				if ( m_pEnv->currentBall.pos.y >= 33.7197 && m_pEnv->currentBall.pos.y < 52.9284 ) 
				{ 
					if ( robot.pos.y - RR - BR > m_pEnv->currentBall.pos.y ) 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x, 19.9442 ); 
					} 
					else if ( robot.pos.y + RR + BR < m_pEnv->currentBall.pos.y ) 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x, 58.5660 ); 
					} 
					else 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x,19.9442 ); 
					} 
				} 
				if ( m_pEnv->currentBall.pos.y >= 52.9284 && m_pEnv->currentBall.pos.y < 58.5660 ) 
				{ 
					if ( robot.pos.y + RR + BR > m_pEnv->currentBall.pos.y ) 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
					} 
					else 
					{ 
						robot.Position( m_pEnv->currentBall.pos.x, 67.5472 ); 
					} 
				} 
/*				if () 
				{ 
				}*/ 
			} 
			robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
		} 
		else 
		{ 
			robot.Position( m_pEnv->currentBall.pos.x + BR + (2*RR), m_pEnv->currentBall.pos.y ); 
		}	 
	} 
	if ( ( m_pEnv->currentBall.pos.x ) > 91.7692-RR ) 
	{ 
		if ( m_pEnv->currentBall.pos.y >= 52.9284 ) 
		{ 
			robot.Position(  m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y + BR+ 2 * RR); 
		} 
		if ( m_pEnv->currentBall.pos.y <= 33.7197 ) 
		{ 
			robot.Position(  m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y - BR- 2 * RR); 
		} 
		 
	} 
	if ( (m_pEnv->currentBall.pos.x + BR) <= 70.1202 ) 
	{ 
		if ( (m_pEnv->currentBall.pos.x + BR) > 60.2706 ) 
		{ 
			if ( ((robot.pos.x-RR-BR)-m_pEnv->currentBall.pos.x) >0 ) 
			{ 
				robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
			} 
			else 
			{ 
				robot.Position( (m_pEnv->currentBall.pos.x+RR+BR), m_pEnv->currentBall.pos.y ); 
			}	 
		} 
		else 
		{ 
			robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
		} 
		 
	} 
} 
 
 
/*************************** 
函数名:MyAttackDefender 
功  能:进攻加防守策略 
输  入:机器人标号 
返  回:无 
备  注:无 
***************************/ 
void CStrategySystem::MyAttackDefender(CRobot& robot) 
{ 
	CVector3D point; 
	CVector3D point1; 
 
	point.x = 37.2016; 
	point.y = m_pEnv->currentBall.pos.y; 
	 
	if (m_pEnv->currentBall.pos.x < 37.2016 && m_pEnv->currentBall.pos.x > 27.8173 ) 
	{ 
		robot.Position( point.x, m_pEnv->currentBall.pos.y); 
	} 
	else 
	{ 
		if ( m_pEnv->currentBall.pos.x >= 37.2016 ) 
		{ 
			if ( m_pEnv->currentBall.pos.x < 48.5016) 
			{  
				if ( m_pEnv->currentBall.pos.y > 43.0032 ) 
				{ 
					robot.Position( point.x , m_pEnv->currentBall.pos.y - BR - 2 * RR); 
				} 
				else 
				{ 
					robot.Position( point.x , m_pEnv->currentBall.pos.y - BR - 2 * RR ); 
				} 
			} 
			else 
			{ 
				robot.Position( point.x , 43.0032 ); 
			} 
			 
		} 
		if ( m_pEnv->currentBall.pos.x <= 27.8173 ) 
		{ 
			if ( m_pEnv->currentBall.pos.y > 58.5600 ) 
			{ 
				robot.Position( point.x, m_pEnv->currentBall.pos.y); 
			} 
			if ( m_pEnv->currentBall.pos.y <= 58.5600 && m_pEnv->currentBall.pos.y > 27.8966 ) 
			{ 
				if ( ((m_pEnv->currentBall.pos.y - BR ) - robot.pos.y )< RR && ((m_pEnv->currentBall.pos.y - BR ) - robot.pos.y ) > (-RR) ) 
				{ 
					robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
				} 
				else 
				{ 
					robot.Position( (m_pEnv->currentBall.pos.x + RR + BR), m_pEnv->currentBall.pos.y ); 
				}	 
			} 
			if ( m_pEnv->currentBall.pos.y <= 27.8966 ) 
			{ 
				robot.Position( point.x, m_pEnv->currentBall.pos.y); 
			} 
		}	 
	} 
	 
} 
 
/******************************************************************************* 
							守门员策略 
*******************************************************************************/ 
/*************************** 
函数名:MyGoalie 
功  能:守门员策略 
输  入:机器人标号 
返  回:无 
备  注:无 
***************************/ 
void CStrategySystem::MyGoalie(CRobot& robot) 
{ 
	Vector3D point; 
	point.y = m_CurrentBall.pos.y; 
//	point.x = 92.7; 
 
//	int nstyle = MyGoalieMoveStyle(m_CurrentBall.pos); 
//	CVector3D ptwant = m_PredictedBall.pos; 
	 
//	Vector3D point; 
//	point.y = env->currentBall.pos.y; 
	point.x = 92.7; 
	 
	if ( m_pEnv->currentBall.pos.y > 33 && m_pEnv->currentBall.pos.y < 51 ) 
	{ 
		robot.Position(point.x,point.y); 
	} 
	else 
	{ 
		if (m_pEnv->currentBall.pos.y > robot.pos.y) 
		{ 
			robot.Position(point.x, 47.8); 
		} 
		else 
		{ 
			robot.Position(point.x, 35.6); 
		} 
		 
	} 
/*	switch(nstyle) 
	{ 
	case 1: 
		robot.Position( 91.7692, 49.3679 );	//到达B点 
		break; 
	case 2: 
		if ( m_CurrentBall.pos.x - robot.pos.x < BR + RR && m_CurrentBall.pos.x - robot.pos.x > (BR + RR) ) 
		{ 
			robot.Position( m_CurrentBall.pos.x, m_CurrentBall.pos.y ); 
		} 
		else 
		{ 
			robot.Position( 91.7692, 52.9284 ); //到达C点 
		} 
		 
		break; 
	case 3: 
		robot.Position( 91.7692, 33.7191 ); //到达C1点 
		break; 
	case 4: 
		robot.Position( 91.7692, 35.5240 );	//到达B1点 
		break; 
	case 5: 
		robot.Position( 91.7692, point.y ); 
		break; 
	case 6: 
		//应该派一个后卫来将球平推出去 
		robot.Position( 91.7692, point.y ); 
		break; 
	case 7: 
		robot.Position( 91.7692, 48.3153 ); 
		break; 
	case 8: 
		robot.Position( 91.7692, point.y ); 
		break; 
	case 9: 
		robot.Position( 91.7692, 33.7191 ); 
		break; 
	case 10: 
		robot.Position( 91.7692, 48.3153 ); 
		break; 
	case 11: 
		robot.Position( 91.7692, point.y ); 
		break; 
	case 12: 
		robot.Position( 91.7692, 36.5368 ); 
		break; 
	case 13: 
		robot.Position( 91.7692, 46.4710 ); 
		break; 
	case 14: 
		robot.Position( 91.7692, point.y ); 
		break; 
	case 15: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 16: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 17: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 18: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 19: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 20: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 21: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 22: 
		robot.Position( 91.7692, 42.2002); 
		break; 
	case 23: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	case 24: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	default: 
		robot.Position( 91.7692, 42.2002 ); 
		break; 
	} 
	*/ 
 
} 
 
int CStrategySystem::MyGoalieMoveStyle(CVector3D BPoint) 
{ 
	if ( (BPoint.x+BR) > 82.5443 )									//当是到达1-6区域时 
	{ 
		if ( (BPoint.y+BR) > 57.2181 )								//当到达区域1时 
		{	 
			return 1;			    
		} 
 
		if ( (BPoint.y+BR) < 26.0746  )							    //当到达区域4时 
		{		 
			return 4; 
		} 
 
		if ( (BPoint.y+BR) <= 57.2181 && (BPoint.y+BR) > 50.7651 )  //当到达区域2时 
		{ 
			//还要考虑当球的X坐标与小车同样时,小车应该奖球推到角落去 
			return 2; 
		} 
 
		if ( (BPoint.y+BR) <= 33.3197 && (BPoint.y+BR) > 26.1135 )  //当到达区域3时 
		{ 
			//还要考虑当球的X坐标与小车同样时,小车应该奖球推到角落去 
			return 3; 
		} 
 
		if ( (BPoint.y+BR) <= 50.7651 && (BPoint.y+BR) > 33.3197 )  //当到达区域5时 
		{ 
			if ( (BPoint.x + BR) <= 86.1956 )						//当到达区域6时 
			{ 
				//应该派一个后卫来将球平推出去 
				return 6; 
			} 
			else 
			{ 
				return 5; 
			}					 
		} 
	} 
 
	if ( (BPoint.x+BR) <= 82.5443 && (BPoint.x+BR) > 60.2706 ) 
	{ 
		if ( (BPoint.y+BR) > 52.9284 )							//当到达区域7时 
		{ 
			return 7; 
		} 
 
		if ( (BPoint.y+BR) <= 52.9284 &&  (BPoint.y+BR) > 33.7197 )//当到达区域8时 
		{ 
			return 8; 
		} 
 
		if ( (BPoint.y+BR) <= 33.7197 )						//当到达区域9时 
		{ 
			return 9; 
		} 
	} 
 
	if ( (BPoint.x+BR) <= 60.2706 && (BPoint.x+BR) > 37.2016 )	 
	{ 
		if ( (BPoint.y+BR ) > 50.7651 )						//当到达区域10时 
		{ 
			return 10; 
		} 
		if ( (BPoint.y+BR ) <= 50.7651 && (BPoint.y+BR ) > 33.3197 )//当到达区域11时 
		{ 
			return 11; 
		} 
		if ( (BPoint.y+BR ) <= 33.3197 )					//当到达区域12时 
		{ 
			return 12; 
		} 
	} 
 
	if ( (BPoint.x+BR) <= 37.2016 && (BPoint.x+BR) > 27.8137 ) 
	{ 
		if ( (BPoint.y+BR ) > 50.7651 ) 
		{ 
			return 13;										//当到达区域13时 
		} 
		if ( (BPoint.y+BR ) <= 50.7651 && (BPoint.y+BR ) > 33.3197 ) 
		{ 
			return 14;										//当到达区域14时 
		} 
		if ( (BPoint.y+BR ) <= 33.3197 ) 
		{ 
			return 15;										//当到达区域15时 
		} 
	} 
 
	if ( (BPoint.x+BR) <= 27.8137 && (BPoint.x+BR) > 19.8003 ) 
	{ 
		if ( (BPoint.y+BR ) > 52.9284 ) 
		{ 
			return 16; 
		} 
		if ( (BPoint.y+BR ) <= 52.9284 && (BPoint.y+BR ) > 33.7191 ) 
		{ 
			return 17; 
		} 
		if ( (BPoint.y+BR ) <= 33.7191 ) 
		{ 
			return 18; 
		} 
	} 
 
	if ( (BPoint.x+BR) <= 19.8003 ) 
	{ 
		if ( (BPoint.y+BR ) > 58.5660 ) 
		{ 
			return 19; 
		} 
		if ( (BPoint.y+BR ) <= 58.5660 && (BPoint.y+BR ) > 49.6801 ) 
		{ 
			return 20; 
		} 
		if ( (BPoint.y+BR ) <= 49.6801 && (BPoint.y+BR ) > 33.9320 ) 
		{ 
			if ( (BPoint.x+BR) >= 11.9571 ) 
			{ 
				return 23; 
			} 
			else 
			{ 
				return 24; 
			} 
			 
		} 
		if ( (BPoint.y+BR ) <= 33.9320 && (BPoint.y+BR ) > 27.8966 ) 
		{ 
			return 21; 
		} 
		if ( (BPoint.y+BR ) <= 27.88966 ) 
		{ 
			return 22; 
		} 
	} 
	return 0;	 
} 
 
/**************************************************************************** 
						角色定位 
****************************************************************************/ 
void CStrategySystem::Role() 
{ 
	Vector3D point; 
//	point.y = m_CurrentBall.pos.y; 
//	point.x = 92.7; 
 
	int nstyle = MyGoalieMoveStyle(m_CurrentBall.pos); 
	switch(nstyle) 
	{ 
	case 1: 
		MyAttack1(m_Home[3],m_Home[4]); 
//		MyAttack(m_Home[3]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 2: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 3: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 4: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 5: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		 break; 
	case 6: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 7: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 8: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 9: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 10: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 11: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 12: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 13: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 14: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 15: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 16: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 17: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 18: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 19: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 20: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 21: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 22: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 23: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	case 24: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	default: 
		MyAttack1(m_Home[3],m_Home[4]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
		break; 
	} 
/*	if ( (BPoint.y+BR ) <= 50.2553 && (BPoint.y+BR ) > 37.2016 ) 
	{ 
		MyAttack(m_Home[4]); 
		MyAttack(m_Home[3]); 
		MyAttackDefender(m_Home[2]); 
		MyGoalie(m_Home[0]); 
		MyDefender(m_Home[1]); 
	} 
	if ( (BPoint.y+BR ) <= 37.2103 && (BPoint.y+BR ) >) 
	{ 
	} 
	*/ 
} 
 
 
 
void CStrategySystem::GoalieAngle() 
{ 
/*	if ( ) 
	{ 
 
	}*/ 
} 
 
void CStrategySystem::MyAttack1(CRobot &robot, CRobot &robot1) 
{ 
	Vector3D point; 
 
	if ( m_pEnv->currentBall.pos.x < 58.2706 ) 
	{ 
		if ( m_pEnv->currentBall.pos.x > 37.2016 ) 
		{ 
			robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
			robot1.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
		} 
		if ( m_pEnv->currentBall.pos.x <= 37.2016  ) 
		{ 
			if ( m_pEnv->currentBall.pos.y > 66.2858 ) 
			{ 
				if ( (robot.pos.x - m_pEnv->currentBall.pos.x) > (RR + BR)) 
				{ 
					robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y); 
				} 
				else 
				{ 
					robot.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y ); 
				} 
			} 
			if ( m_pEnv->currentBall.pos.y <= 66.2858 && m_pEnv->currentBall.pos.y > 19.9442 ) 
			{ 
				if ( m_pEnv->currentBall.pos.x < robot.pos.x ) 
				{ 
					robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
					robot1.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
				} 
				else 
				{ 
					robot.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y + BR ); 
					robot1.Position( m_pEnv->currentBall.pos.y + BR + RR, m_pEnv->currentBall.pos.y - BR ); 
				}	 
			} 
			if ( m_pEnv->currentBall.pos.y <= 19.9442 ) 
			{ 
				if ( (robot1.pos.x - m_pEnv->currentBall.pos.x) > (RR + BR)) 
				{ 
					robot1.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y); 
				} 
				else 
				{ 
					robot1.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y ); 
				} 
			} 
		} 
	} 
	if ( m_pEnv->currentBall.pos.x >= 58.2706 ) 
	{ 
		if ( m_pEnv->currentBall.pos.y > 66.2858 ) 
		{ 
			if ( (robot.pos.x - m_pEnv->currentBall.pos.x) > (RR + BR)) 
			{ 
				robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y); 
			} 
			else 
			{ 
				robot.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y ); 
			} 
		} 
		if ( m_pEnv->currentBall.pos.y <= 66.2858 && m_pEnv->currentBall.pos.y > 19.9442 ) 
		{ 
			if ( m_pEnv->currentBall.pos.x < robot.pos.x ) 
			{ 
				robot.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y ); 
				robot1.Position( 37.2016, 19.9442 ); 
			} 
			else 
			{ 
				robot.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y + BR ); 
				robot1.Position( m_pEnv->currentBall.pos.y + BR + RR, m_pEnv->currentBall.pos.y - BR ); 
//				robot1.Position( ) 
			} 
		} 
		if ( m_pEnv->currentBall.pos.y <= 19.9442 ) 
		{ 
			if ( (robot1.pos.x - m_pEnv->currentBall.pos.x) > (RR + BR)) 
			{ 
				robot1.Position( m_pEnv->currentBall.pos.x, m_pEnv->currentBall.pos.y); 
			} 
			else 
			{ 
				robot1.Position( m_pEnv->currentBall.pos.x + BR + RR, m_pEnv->currentBall.pos.y ); 
			} 
		} 
	} 
}