our strategy so far...
void MainStrategy(Environment * env)
{
double distance, bx, by, rx4, ry4, rx3, ry3, rx2, ry2, rx1, ry1, rx0, ry0, cx, cy, dx, dy, ex, ey;
int state;
bx = env->currentBall.pos.x;
by = env->currentBall.pos.y;
rx4 = env->home[4].pos.x;
ry4 = env->home[4].pos.x;
rx3 = env->home[3].pos.x;
ry3 = env->home[3].pos.x;
rx2 = env->home[2].pos.x;
ry2 = env->home[2].pos.x;
rx1 = env->home[1].pos.x;
ry1 = env->home[1].pos.x;
rx0 = env->home[0].pos.x;
ry0 = env->home[0].pos.x;
distance = GetDistanceTo(4,env,bx,by);
cx = (FRIGHTX-MIDDLEX)/2;//right
cy = (MIDDLEY+20);//Upper
dy = (MIDDLEY-20);//Lower
dx =((MIDDLEX-FLEFTX)/2);//left
ex = MIDDLEX;
ey = MIDDLEY;
//Defender3(2,env);
//Defender2(1,env);
if (distance <10)
{
state = 0;
}
else
{
state = 1;
}
switch (state)
{
case 0:
{
Striker4(4,env);
CoStriker1(3,env);
break;
}
case 1:
{
Striker4(3,env);
CoStriker1(4,env);
break;
}
}
if ((bx>MIDDLEX)&&(by>MIDDLEY))
{
MerlinPosition(&env->home[4],env->currentBall.pos.x,env->currentBall.pos.y,1);
MerlinPosition(&env->home[3],ex, ey, 1.5);
}
if ((bx>MIDDLEX)&&(by<MIDDLEY))
{
MerlinPosition(&env->home[3],env->currentBall.pos.x,env->currentBall.pos.y,1);
MerlinPosition(&env->home[1],ex, ey, 1.5);
}
}
coding kah?
ReplyDeleteyep...
ReplyDeletefor robot soccer...