TAG. - 6


ob[sides][0] += x;

ob[sides][1] += y;

ob[sides][2] += x;

ob[sides][3] += y;

/* .

1, , 0 - */ is_legal(ob, x, y, sides)

int ob[][4]; /* */

int x, y; /* */

int sides; /* */

if(x==0 && y==0)

return 1; /* */

sides--;

for(; sides>=0; sides--)

/* */

if(ob[sides][0]+x>199 || ob[sides][1]+y>319)

return 0;

if(ob[sides][2]+x<0 || ob[sides][3]+y<0)

return 0;

if(read_point(ob[sides][0]+x, ob[sides][1]+y)==2)

return 0;

if(read_point(ob[sides][2]+x, ob[sides][3]+y)==2)

return 0;

return 1;

/* , */

void it_comp_move(ob1, ob2, human, sides)

int ob1[][4],ob2[][4], human[][4], sides;

register int x, y, d; /* d = direction */

static skip = 0;

skip++;

if(skip==3)

skip=0;

return;

/* */

x = 0;

y = 0;

/* */

if(human[0][0]<ob1[0][0])

x = -1;

else

if(human[0][0]>ob1[0][0])

x = 1;

if(human[0][1]<ob1[0][1])

y = -1;

else

if(human[0][1]>ob1[0][1])

y = 1;

if(is_legal(ob1, x, y, sides))

update_object(ob1, x, y, sides);

update_object(ob2, x, y, sides);

else

if(x && is_legal(ob1, x, 0, sides))

update_object(ob1, x, 0, sides);

update_object(ob2, x, 0, sides);

else

if(is_legal(ob1, 0, y, sides))

update_object(ob1, 0, y, sides);

update_object(ob2, 0, y, sides);

/* ,

򠠠 */

void not_it_comp_move(ob1, ob2, dx, dy, sides)

int ob1[][4], ob2[][4];