Пример #1
0
void strategyB(bool useLift)
{
	displayCenteredTextLine(6, "Strategy B");
	//strafeDist(15, 30, dRight);
	gyroTurn(30, 15, dRight);
	travelDistance(15, dBackward);
	goalCenter(useLift);
	gyroTurn(30, 10, dLeft);
	strafeDist(45, 50, dLeft);
	travelDistance(125, dBackward);
}
Пример #2
0
void strategyC(bool useLift)
{
	displayCenteredTextLine(6, "Strategy C");
	//strafeDist(50, 75, dRight);
	gyroTurn(30, 48, dRight);
	strafeDist(25, 75, dRight);
	travelDistance(21, dBackward);
	goalCenter(useLift);
	gyroTurn(30, 10, dLeft);
	strafeDist(45, 75, dLeft);
	travelDistance(125, dBackward);
}
Пример #3
0
void strategyA(bool useLift)
{
	displayCenteredTextLine(6, "Strategy A");
	gyroTurn(30, 90, dLeft);
	stopMotors();
	wait1Msec(100);
	travelDistance(40, dBackward);
	wait1Msec(100);
	strafeDist(27, 100, dLeft);
	wait1Msec(100);
	goalCenter(useLift);
	strafeDist(45, 50, dLeft);
	gyroTurn(30, 10, dLeft);
	travelDistance(125, dBackward);
}
void GoaliePen::doBlock()
{
	cout << "[Goalie-Penalty] i'm blocking " << endl;

	Point pole1 = pWorldData->ourPole1;
	Point pole2 = pWorldData->ourPole2;

	pole1.x *= -1;
	pole2.x *= -1;

	Point myPoint1,myPoint2;
	Line firstLine,secondLine;
	Point ballPos = pWorldData->basedCenter(pWorldData->ball());
	Point nearstOppToBall = pWorldData->basedCenter(pWorldData->opponent(pWorldData->getNearstOppToPoint(ballPos)));
	Point goalCenter((pole1.getX() + pole2.getX()) / 2, (pole1.getY() + pole2.getY()) / 2);
	Point blockPoint;


	if(pole1.getX() < 0)
	{
		myPoint1.x = pole1.getX() + 100;
		myPoint1.y = pole1.getY();

		myPoint2.x = pole2.getX() + 100;
		myPoint2.y = pole2.getY();
	}
	else
	{
		myPoint1.x = pole1.getX() - 100;
		myPoint1.y = pole1.getY();

		myPoint2.x = pole2.getX() - 100;
		myPoint2.y = pole2.getY();

	}

	firstLine.setByPoints(myPoint1,myPoint2);
	secondLine.setByPoints(nearstOppToBall,goalCenter);

	firstLine.getLineIntersect(secondLine,blockPoint);

	cout << "[Goalie-Penalty][doBlock] blockPoint:  " << blockPoint << endl;

	pBasicPlayer->go(blockPoint.getX(),blockPoint.getY());
}
void PenaltyPlan::decide()
{
	vector <int> opps = pWorldData->mr_found_opponents();

	Vector Me = pWorldData->me(true);

	Point ballPos = pWorldData->basedCenter(pWorldData->ball());
	Point me(Me.getX() , Me.getY());
	Point nearstOppToMe;

	if(opps.size() != 0)
			nearstOppToMe = pWorldData->basedCenter(pWorldData->opponent(pWorldData->getNearstOppToPoint(Me)));

	Point pole1 = pWorldData->oppPole1;
	Point pole2 = pWorldData->oppPole2;
	Point goalCenter((pole1.getX() + pole2.getX()) / 2, (pole1.getY() + pole2.getY()) / 2);

	if(opps.size() != 0)
	{
		if(!pBasicPlayer->can_kick())
		{
			cout << "[PenaltyPlan] i'm dribbling" << endl;
			doDribble();
		}
		else
		{
			if(me.getDistance(goalCenter) > 190)
			{
				cout << "[PenaltyPlan] i'm dribbling" << endl;
				doDribble();
			}
			else
			{
			    cout << "[PenaltyPlan] my dist from goalCenter:  " << me.getDistance(goalCenter) << endl;
				cout << "[PenaltyPlan] i'm shooting" << endl;
				doShoot();
			}
		}
	}

}