Update StrategySystem.cpp

This commit is contained in:
xixu-me committed 2024-03-21 07:58:19 +08:00
1 parent a1a137269d
commit 83f1f06127
1 file changed
+3 -6
+3 -6
View File
@@ -26,17 +26,15 @@ void CStrategySystem::Penalty() {
srand(time(nullptr));
int x = rand() % 2;
int d = 21;
static bool faceR;
// Direction(HOME1, CPoint(ball.position.x + 104, ball.position.y));
static bool faceR; // 角度
if (x) {
if (Distance(home1.position, ball.position) > d) {
Direction(HOME1, ball.position);
faceR = fabs(home1.angle) > 90;
}
else {
// flag = false;
double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 505)))); // 求曲线行驶时轨迹的半径
int lw = (r - 3) / (r + 5) * 127;
int lw = r / (r + 6) * 127;
if (faceR)
Velocity(1, lw, 127);
else
@@ -49,9 +47,8 @@ void CStrategySystem::Penalty() {
faceR = fabs(home1.angle) > 90;
}
else {
// flag = false;
double r = Distance(home1.position, ball.position) / (2 * (sin(atwo(home1.pos.x, home1.pos.y, ball.position.x, ball.position.y, ball.position.x, ball.position.y, 28, 313))));
int rw = r / (r + 3) * 127;
int rw = r / (r + 6) * 127;
if (!faceR)
Velocity(1, -rw, -127);
else