void move( void )
{
int i,j;
bool flag = true;
switch( d_direct )
{
case DD_DOWN:
if ( d_state )
{
if ( bottle->empty( d_x, d_y+1 ) )
{
++d_y;
break;
}
}
else
{
if ( bottle->empty( d_x, d_y+1 ) && bottle->empty( d_x+1, d_y+1 ) )
{
++d_y;
break;
}
}
/*************这里没写完,预计是个while(true)的循环*********************/
while ( flag )
{
flag = false;
if ( d_state )
{
bottle->set( d_color[0], d_x, d_y );
if ( d_y-1 != 0 )
bottle->set( d_color[1], d_x, d_y-1 );
}
else
{
bottle->set( d_color[0], d_x, d_y );
bottle->set( d_color[1], d_x+1, d_y );
}
for ( i = 14; i >= 0; ++i )
{
for ( j = 0; j < 8; ++j )
{
if ( bottle->)
}
}
delay( 500 );
}
break;
case DD_UP:
if ( d_state )
{
if ( bottle->empty( d_x+1, d_y ) ) d_state = false;
else if ( bottle->empty( d_x-1, d_y ) ) { --d_x; d_state = false; }
}
else
{
if ( bottle->empty( d_x, d_y-1 ) )
{
d_state = true;
Color tmp = d_color[0];
d_color[0] = d_color[1];
d_color[1] = tmp;
}
else if ( bottle->empty( d_x+1, d_y-1 ) )
{
++d_x;
d_state = true;
Color tmp = d_color[0];
d_color[0] = d_color[1];
d_color[1] = tmp;
}
}
break;
case DD_LEFT:
if ( d_state && bottle->empty( d_x-1, d_y ) && bottle->empty( d_x-1, d_y-1 ) ) --d_x;
if ( !d_state && bottle->empty( d_x-1, d_y ) ) --d_x;
break;
case DD_RIGHT:
if ( d_state && bottle->empty( d_x+1, d_y ) && bottle->empty( d_x+1, d_y-1 ) ) --d_x;
if ( !d_state && bottle->empty( d_x+1, d_y ) ) --d_x;
break;
default:
break;
}
}